Visit Jeremy's Blog.
Go Back > Forums > Linux Forums > Linux - General
User Name
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.


  Search this Thread
Old 06-14-2002, 09:07 PM   #1
Registered: May 2002
Location: Shanghai, PRC
Distribution: RedHat 6.2 | 7.2 | 8 | 9|3
Posts: 81

Rep: Reputation: 15
Red face How can I catch some "KEY WORDS" from a text file without opening it?

Hi all,

How can I catch some "KEY WORDS" from a text file without opening it?
I mean -- We can use "ps -ef |grep named" to take out "named" lines from the output. Now, if I am interested with some "KEY WORDS" in a text file, how can I take out the line which contains the "KEY WORDS"?
Thank you very much.

Old 06-14-2002, 09:27 PM   #2
Senior Member
Registered: Feb 2001
Location: Atlanta, GA
Distribution: Slackware
Posts: 1,823

Rep: Reputation: 120Reputation: 120
grep key filename
cat filename | grep key


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Delete text between key words : sed shalomajay Programming 7 05-11-2011 06:22 PM
Windows XP opening Samba file as "READ ONLY"? core_sa Red Hat 0 08-28-2004 01:55 PM
remove "special" text out of a file tearinox Linux - General 1 03-15-2004 08:43 PM
"how do I extract a number from a text file using shell command?" sdandeker Linux - Networking 3 02-12-2004 08:54 AM
Inputting a text file in to the "rm" command R4z0r Linux - General 5 12-28-2003 05:44 PM > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 01:55 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration