I extract two numerical strings from a textfile and and want to combine them to create a new string. The new string will be a filename.
This is the textfile dates.dat
:
378464,2015-01-31
1019348,2015-03-31
1019342,2015-03-31
1019347,2015-03-31
1019349,2015-05-11
My shell script:
while IFS=, read line
do
IFS=',' read -r id date <<< "$line"
filename="${date}-${id}.xml"
echo $filename
done < "dates.dat"
All I see is 3784641-31 1019348-31 1019342-31 1019347-31 1019349-11
. But I expect 2015-01-31-378464.xml
etc.