The following script works.
for line in $(cat temp.csv);do high52=$(echo $line|cut -d, -f4);high=$(echo
$line|cut -d, -f2);if [[ $high52 = $high ]]; then stock=$(echo $line|cut -d,
-f1); echo $stock >> highs;fi;done
But when it is put in a script file, than command line as
#!/bin/sh
rm -f highs
for line in $(cat temp.csv)
do
high52=$(echo $line|cut -d, -f4)
high=$(echo $line|cut -d, -f2)
stock=$(echo $line|cut -d, -f1)
if [[ $high52 = $high ]]
then
echo $stock >> highs
fi
done
I get error as
/home/lvgandhi/bin/gethilo: 12: [[: not found
Any suggestions please?
[EMAIL PROTECTED]:~$ head -n5 temp.csv
SYMBOL,HIGH_PRICE,LOW_PRICE,HI_52_WK,LO_52_WK
ABB,4368.10,4211.65,4368.10,1900.00
ACC,894.00,870.00,1194.80,601.00
BAJAJAUTO,2250.00,2170.00,3375.20,2074.10
BHARTIARTL,863.40,842.00,882.05,307.30
--
L.V.Gandhi
http://lvgandhi.tripod.com/
linux user No.205042

Reply via email to