I have a requirement of reading some CSV files one by one, CSV files will be named Test1.csv,Test2.csv, etc. The code:
#!/bin/bash
IFS=","
FILES=/CSVFiles/*
CSVNAME=Test
n=1
for f in $FILES
while read Column1 Column2
do
echo $Column1
echo $Column2
done < "$CSVNAME"$n.csv
n=$((n+1))
Returns these errors:
./ReadCSV.sh: line 23: syntax error near unexpected token `while'
./ReadCSV.sh: line 23: `while read Column1 Column2
/CSVFiles/is really in the root directory. Pleasecdto that directory and show the output ofreadlink -e Test1.csv.