Hi all,
I have a text file created in Windows with the following format
Code:
<name1> <number1>
<name2> <number2>
. .
. .
. .
I want to be able to parse out the <number> values from the file via a bash script. I have created a script
Code:
#!/bin/bash
file="/home/test/file.txt"
cat ${file} | \
while read name num
do
sum=$(($sum + $num ))
echo "$sum"
done
which works well on a text file with the above format created in linux, but does not work on a text file created in windows. So, how do I go about converting a windows formatted text file to *nix format? Something that could be done in bash is the optimum solution for me.
Thanks for any help.