The simplest way would to add a simple grep that ignores lines starting with #... like so
cat $Parmdir/jobname.lst | grep -v ^# | while read line
The "^" character, in case you're not familiar, specifies the beginning of a line. So if we group that with the -v (invert matching, aka do not print matching lines) it states do not print any lines that begin with the hash mark. (#)
Enjoy!
Quote:
Originally Posted by
Amey Joshi
Hi,
I have develop a script that will read a single line from file and do some operations.But now my problwm is that if in that file suppose 1 line is commented, then i have to ignore that line...Can anybody help me out to solve this issue?
Details are:
Script:
HTML Code:
#!/bin/sh
Parmdir=/opt/home/xyz
cat $Parmdir/jobname.lst | while read line
do
some command
done
cat jobname.lst
HTML Code:
ABCD
EFGH
#AFFF
RRRRR
So in the above script i have to ignore the 3rd line.
Please help me.
Thanks In Advance!