Consider below two variables
Have a CSV file,
fileSB.csv. I found a command (below) to search for the
DC variable name in 2nd column and
CountryCode variable name in 4th column. Only if both variable matches in the same line, then that particular line will be printed.
Now my requirement is that in the same row/line as detected using below command, I want to print only the values present in 12th column. The problem here is that 12th column can have any number of commas in it and hence not able to print values in 12th column
Command to print line that matches both variable values from file name
awk -v pat1="$DC" -v pat2="$CountryCode" -F, '($2==pat1&&$4==pat2)' fileSB.csv
Summary: Need to get the 12th column from the comma-separated output of
awk, which may contain any number of commas, and is followed by another 10 columns.