I want to extract the row of a CSV file where column 4 contains a certain number.
The CSV file's rows look like this:
Markus;Haltmeyer;ID;SomeIdentifier
I want to store the first column and second column in different variables each, if SomeIdentifier is fownd.
In the bash script I only have the first characters of SomeIdentifier in a variable firstPartOfID. But nevertheless the correct row is found with the following command:
result=$(awk -v pat="${firstPartOfID}" -F ";" '$0~pat{print $1, $2 }' MyFile.csv)
echo ${result}
Unfortunately result contains both columns. I could try to split $result afterwards, but I want to do it with awk directly.