I'm trying to delete the last 2 columns of a csv file with awk. I have tried using:
x=$(awk -v FPAT='([^,]*)|(\"[^\"]+\")' -v OFS=',' '{$10=$11=""; print $0}' ${filename} > nse.csv)
But it just deletes the data in the columns not deletes it.
For example if this is the original csv:
a,b,c,d,e,f,g,h,i,j,k
1,2,3,4,5,6,7,8,9,10,11
The nse.csv will look like this:
a,b,c,d,e,f,g,h,i,,
1,2,3,4,5,6,7,8,9,,
Instead of:
a,b,c,d,e,f,g,h,i
1,2,3,4,5,6,7,8,9