i'm learning bash scripting and i wrote this simple script:
#!/bin/bash
for f in $(cat test.csv | cut -d';' -f 4)
do
EXT=".pdf"
echo "$f$EXT"
done
Where the file test.csv is:
col1;col2;col3;test1
col1;col2;col3;test2
col1;col2;col3;test3
...
the output of this script is:
.pdf
.pdf
.pdf
...
The output expected would be:
test1.pdf
test2.pdf
test3.pdf
...
Sorry for stupid questions but i'm stuck in this, i think, little problem.
Same output with this script:
#!/bin/bash
while IFS=\; read col1 col2 col3 col4
do
echo "$col4".pdf
done < test.csv
test.csv? BTW How are you running the script?echo "$col4"without .pdf string. I run it via macosx terminal ./script