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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Want to find a line in a file and print the output

Status
Not open for further replies.

bas1080

IS-IT--Management
Sep 2, 2003
21
US
How can i find a line in a sequence of files and print the output to another file.

Thanks in Advance
 
I want to write a shell script for this. I am new to shell so could anyone help with this. What i may want to do is to get the grep results in a declared variable and print it out.

Thanks
 
And what have you so far ?

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
test_file = zcat myname.tgz | tar -tvf - |cat /etc/inet/inetd.conf | grep lpstat

I want to store the output to test_file and print it.But it is giving error.


 
Can you define what you're trying to do better? I can't quite tell from your original post and from what you have so far.
 
I'm quite a novice to this shell scripting i'm afraid - but how come you have not redirected output with the >

i.e.
grep 'lpstat' FILES > grep_output.txt


Kind Regards
Duncan
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top