There are other similar questions online out there, but I just couldn't figure out what's wrong with my code after trying those online suggestions. Below is my code:
LineNum = `wc -l < /data/${INPUT:0:4}/${INPUT:4:2}/positions.$INPUT`
if [2 -le "$LineNum"]
then
echo ""
else
awk 'NR!=1 {print $0}' /data/${INPUT:0:4}/${INPUT:4:2}/positions.$INPUT | column -t
fi
So the $INPUT is in the format of YYYYMMDD, and I want the file to be displayed if the row count is more then a specific number. But I keep getting the error message "Command Not Found" for the if test.
Any suggestions is highly appreciated!
You are missing spaces around your condition. Try if [ 2 -le "$LineNum" ]
.