Support LQ: Use code LQ3 and save $3 on Domain Registration
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 08-29-2007, 02:28 PM   #1
Registered: Aug 2003
Posts: 232

Rep: Reputation: 30
find a key words in a file


I have a huge file and I am only interest in loooking for the error that translate to the key words, below is my example within the file:

[28/Aug/2007:16:00:11 00] "GET /pls/orasso/orasso.wwsso_app_admin.ls_login?Site2pstoreToken=8F5F4DE8~DF7915230F9792769C4324C9D53422 AAA 100

as you can see, at the end of the error, there are AAA and 100, AAA are the keys words that I am looking for. Basically, I want to get the whole error string that had AAA and write all of those errors to a file.

Can someone help?

Old 08-29-2007, 02:39 PM   #2
LQ Addict
Registered: Jul 2003
Location: London, UK
Distribution: Slackware
Posts: 7,464

Rep: Reputation: Disabled
Use grep? grep pattern file > out file, e.g. grep "AAA 100" input > output.
Old 08-29-2007, 04:20 PM   #3
Registered: Sep 2006
Location: Durham, NC
Distribution: Slackware, Ubuntu (yes, both)
Posts: 463

Rep: Reputation: 31
You want grep, sed and awk; mostly grep as Nylex pointed out. See the
grep man page, and then get Classic Shell Scripting from
O'Reilly, it goes into a lot of detail about how to handle these things.

Old 08-29-2007, 04:30 PM   #4
LQ Guru
Registered: Nov 2006
Location: Belgium
Distribution: Ubuntu 11.04, Debian testing
Posts: 5,019

Rep: Reputation: 130Reputation: 130
You can also consult the Rute book (check google) to get you started. You'll still need another book if you need more in-depth coverage.


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
GREP - reg exp to find words ending with .V and .TO vikram_cvk Linux - Server 5 12-22-2006 01:47 PM
Key in Chinese/Japanese words WindowsKiller SUSE / openSUSE 1 11-08-2005 07:50 PM
Search and Replace: Asian Words to English Words ieeestd802 Linux - Software 0 10-27-2004 07:48 PM
How can I catch some "KEY WORDS" from a text file without opening it? yuzuohong Linux - General 1 06-14-2002 09:27 PM

All times are GMT -5. The time now is 05:17 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