Hello, I would like to write a script which will read a text file and do something. And I want to skip those blank lines or lines with spaces. How could I do so?
Thanks!
--------------------
(abc.txt)
111
222
333
(script.sh)
!/bin/sh
if [ -f $PWD/test.txt ]; then
cat test.txt | while read LINE
do
if [ -n $LINE ]; then
echo $LINE
fi
done
fi
---
I also tried "if [ $LINE != '' ]; then" statement, but still failed....
my expected result in screen would be :
111
222
333
Thanks!
--------------------
(abc.txt)
111
222
333
(script.sh)
!/bin/sh
if [ -f $PWD/test.txt ]; then
cat test.txt | while read LINE
do
if [ -n $LINE ]; then
echo $LINE
fi
done
fi
---
I also tried "if [ $LINE != '' ]; then" statement, but still failed....
my expected result in screen would be :
111
222
333