some problem in scripting.
I created a .csv file in this format from a original file from the net. The last field here is the last field in original file also. I made this file as original file has empty lines and single field lines also.
I am using this script to find high/low
rm -f highs
rm -f lows
for line in $(cat temp.csv)
low52=$(echo $line|cut -d, -f5)
high52=$(echo $line|cut -d, -f4)
low=$(echo $line|cut -d, -f3)
high=$(echo $line|cut -d, -f2)
stock=$(echo $line|cut -d, -f1)
if [ $high52 = $high ]
echo $stock >> highs
if [ $low52 = $low ]
echo $stock >> lows
I get highs file. I don't get lows file. I feel there is some unprintable at the end of csv file. Hence matching fails.
I added one more field and found that ^M in the LO_52_WK field before comma. I tried sed -e 's/M$//'. this didn't help.
linux user No.205042