i am using "awk" command to read my csv file, i want to use it with a condition, if the condition is valid i want to take the "row" not with all the colomns and write it in another csv file.
for example:
the CSV File:
fname lname id address street phone telephone
row1:myfname mylname 123 serlanka j12street 05666355 02365410
row2...
row3...
the condition: if the row have an id "123" -> then i want just fname, lname and id columns in the new csv.
i'v used awk command in my code.
code:
zcat "$FileName" | awk -F'\t' '(($4 >=400) && ($4 <=599)) {Str="HTTP Error: " $4;print Str >> "New.csv"}'
More or less add this to the end of your script:
$3 ~ /123/ {print $1,$2,$3 >> "New.csv"}