I\'d like to delete a selection of columns from a list of CSV files. The awk call is in-line as it is used in a shell script. I don\'t know beforehand how many columns the files
BEGIN {FS=",";
split("1,2,3,4",dropers,",")
}
{ split($0,row,FS);
for(i in dropers) delete row[i];
print NF "," length(row) "<<<";
out="";
print NF "," length(row) ">>>";
for(i in row){print row[i] "lulu";
out = out "," row[i]};
out = substr(out,2)
sub(/[ \t]*$/,"",out);
print out
}
with input:
a,b,c,d,e,f,g
prints:
7,3<<<
7,3>>>
elulu
flulu
glulu
e,f,g