Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Selecting an entire line in a text file - insteed of the individual wo 1

Status
Not open for further replies.

Larshg

Programmer
Mar 1, 2001
187
DK
Hi

I have a text file that looks something like this
[23][<1][CRITICAL][unixprocexists.sh /usr/sbin/xntpd][10][][1][Process /usr/sbin/xntpd not running.]
[24][<1][CRITICAL][unixprocexists.sh sendmail][10][][1][Process sendmail not running.]

I want run throu the file one line at the time, seleting the entyre line


If I do something like this
for item in `cat /ovchk.cfg`
do
echo $item
done

Then the $item is the individual words - I would like it to be the intire line.

Thanks
Larshg


 
Try something like this:
while read item
do
echo "$item"
done < /ovchk.cfg

Hope This Help, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884
 
Hi:

Use the following loop:

while read line
do
echo $line
done < data.file

Regards,


Ed
 
Thanks

I've been looking for this for a while(it used to be a bit more messy seperating it and reconising the variables)

/Larshg
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top