I have a file with multiple lines and want to do the following with each line..
- Set three variables from an awk output.
- Do something with the variable data (in my example, echo them).
My script successfully does what I want it to, however only for the first line of the file.
#!/bin/bash
while read LINE; do
set -- $(awk -F";" '{print $1, $2, $3}')
var1=$1
var2=$2
var3=$3
echo $1
echo $2
echo $3
done < /path/file
Sample of file data:
NPK;20140325;272128;4579
NPK;20140329;272826;4977
NPK;20140320;271832;4248
NPK;20140415;273213;6698
NPK;20140406;272703;5708
NPK;20140408;272204;5811
NPK;20140324;271966;4465
NPK;20140401;272507;5253
NPK;20140403;272638;5487
Any ideas?
cheers M