LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   find a key words in a file (https://www.linuxquestions.org/questions/linux-general-1/find-a-key-words-in-a-file-580760/)

ashley75 08-29-2007 02:28 PM

find a key words in a file
 
Hi,

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?

thanks

Nylex 08-29-2007 02:39 PM

Use grep? grep pattern file > out file, e.g. grep "AAA 100" input > output.

trashbird1240 08-29-2007 04:20 PM

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.

Joel

jay73 08-29-2007 04:30 PM

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.


All times are GMT -5. The time now is 12:20 AM.