How do I scan several hundreds files for, in each file the first instance of an entry in a particular column and.......
by sean mckinney from LinuxQuestions.org on (#5BQDP)
I want to scan several hundreds files, all csv's and all in one folder, for, in each file/csv, the first instance of an entry in column number 'such and such' and output that entire line to another csv in a differing folder.
How may I do this?
For a given file the following appears to be a start
gawk ' { if (NF >= 4){if (S111 =="") print $0}} ' *.csv > /home/name/test/test.csv
but it outputs every line with a relevant entry.
The csv's are perhaps large, 200+ columns and up to 15,000 rows.
I have come across a grep command that does this but that searches for specific text in any column and I seek a solution for entries that do not contain specific text.
Pressing my luck and possibly more difficult, it might also be useful if I could also output the last line to contain and entry in the desired column but that may be a question for a later threads.
Thanks for any assistance.


How may I do this?
For a given file the following appears to be a start
gawk ' { if (NF >= 4){if (S111 =="") print $0}} ' *.csv > /home/name/test/test.csv
but it outputs every line with a relevant entry.
The csv's are perhaps large, 200+ columns and up to 15,000 rows.
I have come across a grep command that does this but that searches for specific text in any column and I seek a solution for entries that do not contain specific text.
Pressing my luck and possibly more difficult, it might also be useful if I could also output the last line to contain and entry in the desired column but that may be a question for a later threads.
Thanks for any assistance.