Can an expert kindly write an efficient Linux ksh script that will strip rows with no numbers from a text file?
Supposing there are three rows that text file called text.txt :
"field1","field2","field3",11,22,33,44
"field1","field2","field3",1,2,3,4
"field1","field2","field3",,,,
The above rows are delimited by commas.
I want to strip out the last row that does not have numbers in the last 4 fields. So the new file text2.txt will only have two rows.
"field1","field2","field3",11,22,33,44
"field1","field2","field3",1,2,3,4
Thanks in advance.
(I suppose an awk command will do the job, but am not sure how to write it. here is a start:
awk '{ if (index($0,"\"\",")==4) {print > "text2.txt" } }' bigfile