Awk, ^ backslash is not the last character in a string

I am trying to use gawk on windows to parse a directory that contains CSV files for blank lines in the second column in each file. I want to take the entire row where the second column is empty from ALL source files and output to csv ... which I am so far below.

I'm sure it has to do with avoiding single quotes, I've tried using ^

and to \

no avail. Thanks for any advice.

awk -F, \'!length$2\' *.csv > output.csv 

      

+3


source to share


1 answer


Thanks to Etan Reisner and HuStmpHrrr, I am working now. If you would like to post responses, I can mark them so that you receive reputation points. Your hints pointed me in the right direction. Now I have all lines with empty 2nd line in one file. The final working version of the command in my case:

awk -F, !length($2) *.csv > output.csv    //Works ( in windows)

      



  • I'm not sure why my answer was edited, but the above doen`t line works when you enclose it in single quotes.

    awk -F, '! length ($ 2) '* .csv> output.csv // Don`t Work (in windows)

+1


source







All Articles