linux - filter text file rows by certain column without quotation marks -
so have file i'd rows from, unfortunately strings within rows aren't surrounded quotation marks. how can filter these rows based on 2nd column value?? eg have:
string a,string b,string c,string d,string e string 1,string 2,string 3,string 4,string 5 string f,string b,string h,string i,string j string 6,string 7,string 8,string 9,string 0
and want in new file only:
string a,string b,string c,string d,string e string f,string b,string h,string i,string j
i'm trying use command:
awk -f '","' 'begin {ofs=","} { if (toupper($2) == "string b") print }' input.csv > output.csv
you don't need include double quotes on setting fs value.
$ awk -f, 'begin {ofs=","} { if (toupper($2) == "string b") print }' file string a,string b,string c,string d,string e string f,string b,string h,string i,string j
Comments
Post a Comment