Save the following as "myscript"...
for i in `cat $1`
do
var1=$(echo $i | awk -F\# '{print $1}')
var2=$(echo $i | awk -F\# '{print $2}')
echo "var1=${var1} var2=${var2}"
done
Assuming your data is in "datafile"...
1211667249500#3265
1211667266687#2875
1211667270781#1828
Run the script....
myscript datafile
Output it produces...
var1=1211667249500 var2=3265
var1=1211667266687 var2=2875
var1=1211667270781 var2=1828
So it actually reads the logfile line by line, instead of all lines at once. But also reads it one line after the previous one.
Thanks for all the replies
ps.
When I do awk -F'#' '{print $2/1000}' log I get 3.265
and when I do awk -F'#' '{print $1/1000}' log I get 1.21167e+09 is there a way to get the full number instead?