I have this script that almost the same as another but while the other script works fine this one does not want to work.
It has to replace the ;
with ,
and to join some csv files located in a path starting with some name, excluding the first line of all the files except the first one.
Here is my script.
#!/bin/bash
if [ -f /Desktop/AnotherFolder/newname.csv ]
then
rm /Desktop/AnotherFolder/newname.csv
fi
i=0
for f in /Desktop/NewFolder/somename*.csv
do
if [ $i -eq 0 ]
then
#Converto il carattere | in virgola
sed 's/;/,/g' $f > /Desktop/AnotherFolder/newname.csv
let "i += 1"
else
tail -n+2 $f | sed 's/;/,/g' $f >> /Desktop/AnotherFolder/newname.csv
fi
done
Error:
line 18 Bash error: syntax Syntax error: unexpected end of file