Hi gurus..
Am reading a file, counting number of lines and storing it in a variable. Then am passing that variable into If loop for comparision, if the number of lines are greater than 1000 it should split a file if not it should send the file name to archive folder.. but when i execute the program comparision in IF loop is geting failed.. I dont know where am i going wrong, pls help me
count=`cat $file | wc -l`
if [ "$count" > 1000 ]
then
sed -i '1d' $file
split -l 1000 $file new
for i in ne*
do
mv $i $i".csv"
done
else
echo "$count"
move_file
fi
When am passing a file with less than 1000 records the file is not getting moved to archive.
move_file is my function
cp $file ${file%.*}_$n.${file#*.}
mv ${file%.*_$n.${file#*.} /data/archive/
here else statement is getting failed when i pass files have 5000 records then it is working
I also tried with count=`wc -l $file`
echo "$count"
This i have just put to test the "count" but else is getting failed & its not getting print