У вас есть write_enable=yes
в vsftpd.conf
? По умолчанию no
.
Измените это и повторите попытку. Я думаю, что другая ошибка является результатом этого.
Этот Perl-скрипт сделает то, что вы хотите:
#!/usr/bin/perl
## Read the file's lines into the @lines aray.
my @lines = <>;
## read the values from the first line and save them as @values
my @values = split(/,/, $lines[0]);
## Iterate over the values. $#values is the number of elements
## in the array.
for my $i (0..$#values){
## Remove trailing newlines and save this value as $value
chomp(my $value = $values[$i]);
## Iterate over each line
for my $k (0..$#lines ) {
## remove trailing newlines.
chomp($lines[$k]);
## Get this line's values
my @lineValues = split(/,/, $lines[$k]);
## If the value at position $i on this line is the same
## as the value at position $i of the first line.
if ($lineValues[$i] == $value) {
## Set this value to 1
$lineValues[$i] = 1
}
## If they are not equal
else {
## Prepend '0,' to this line's value
$lineValues[$i] = '0,'. $lineValues[$i];
}
## Save the modified line back in the @lines array
$lines[$k] = join ',', @lineValues;
}
}
## Print the final output
print join "\n", @lines;
print "\n";
Сохраните это как foo.pl
и запустите следующим образом (показывая вывод, если запустить файл примера из вопроса):
$ perl foo.pl foo.csv
1,1,1,1,1
0,1,0,1,1
1,0,1,1,0,
И в файле, на который вы ссылаетесь:
$ perl foo.pl file.csv
1,1,1,1,1,1
1,0,1,0,1,1
0,1,0,1,1,1
0,0,1,1,1,1
0,1,1,1,1,1
1,1,1,0,0,1
0,1,1,1,0,1