I am using the below script to read the values of the 3rd column of the CSV file. However, I am getting a Syntax error.
tr -d '\r' < p_test.csv > fixed_p_test.csv
while IFS="," read -r rec1 rec2
do
echo "Displaying Record-$rec1"
echo "Price: $rec2"
done < <(cut -d "," -f1,3 fixed_p_test.csv | tail -n +2)
While running the above script I am getting the below error:
pScanFinal.sh: line 9: syntax error near unexpected token `<'
pScanFinal.sh: line 9: `done < <(cut -d "," -f1,3 fixed_p_test.csv | tail -n +2)'
My p_test.csv look like:
A | B | C | D | E |
---|---|---|---|---|
192.158 | True | 12 | HT | Open |
254.658 | False | 58 | SM | Closed |
How can I resolve this error?