LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 04-01-2010, 02:54 AM   #1
Volcano
Member
 
Registered: Sep 2005
Posts: 172

Rep: Reputation: 15
what command to shoot ?


I need a Linux command.

My objective is to find exception/errors in log file.

As of now, I just do a 'tail -200f ms01.log' ... this just prints the last 200 lines from the log files.


I'm not happy with my command. Can we make it smarter . I want to print only the exception stacks from my log file.

what command to shoot ?
 
Old 04-01-2010, 03:00 AM   #2
GrapefruiTgirl
LQ Guru
 
Registered: Dec 2006
Location: underground
Distribution: Slackware64
Posts: 7,594

Rep: Reputation: 551Reputation: 551Reputation: 551Reputation: 551Reputation: 551Reputation: 551
Code:
tail -200f ms01.log | grep 'error'
Replace 'error' with the term you want to show lines containing. If more than one term is required, use:

grep 'term1\|term2\|term3'

Note: this is only a simple grep -- if you need to filter for strange words or regular expressions, you will need a heftier grep command.

Also: I believe you meant to write "Which command to execute", not "Which command to shoot"

Sasha
 
Old 04-01-2010, 03:16 AM   #3
Volcano
Member
 
Registered: Sep 2005
Posts: 172

Original Poster
Rep: Reputation: 15
thanks for the correction . thanks for the help
 
Old 04-01-2010, 03:23 AM   #4
prpednek
LQ Newbie
 
Registered: Mar 2010
Location: India
Distribution: RHEL
Posts: 22

Rep: Reputation: 16
Quote:
Originally Posted by Volcano View Post
thanks for the correction . thanks for the help
Hi,
tail -200f <LOGFILE> | grep -i '<PATTERN>'

This command will tail the particular log and output the line with the matching pattern ignoring case.

Hope this helps.

Cheers,
Prasad.
 
Old 04-01-2010, 05:21 AM   #5
Volcano
Member
 
Registered: Sep 2005
Posts: 172

Original Poster
Rep: Reputation: 15
Glad to know this ...thanks
 
  


Reply


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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
what command to shoot ? Volcano Linux - Newbie 7 01-14-2010 05:14 AM
Gonna Shoot Myself.. (What Not To Do) ToBe Linux - Newbie 5 09-02-2005 06:15 PM
Don't shoot me, CD-4 question Wakim Mandriva 4 01-02-2005 09:17 PM
shoot the newbie... Tisch Debian 2 01-17-2004 05:30 PM
startx !!!! help me im about to shoot myself hydro Linux - Newbie 6 02-20-2003 02:10 AM


All times are GMT -5. The time now is 08:32 PM.

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