LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 02-19-2008, 02:05 AM   #1
kriezo
LQ Newbie
 
Registered: Jan 2008
Posts: 14

Rep: Reputation: 0
[bash] get user unknown ip from maillog


hi guys can u help here..
i can't find a command or any bash script to get ip for User unknown in my maillog file.

I had try to grep that line contain User unknown tag like this :

grep '[.][.][.] User unknown' maillog

but unfornately the ip was not in the line. Realized that the ip state one line after that.

Somebody please help..
 
Old 02-19-2008, 02:49 AM   #2
slakmagik
Senior Member
 
Registered: Feb 2003
Distribution: Slackware
Posts: 4,113

Rep: Reputation: Disabled
man grep; grep -A, -C
 
Old 02-19-2008, 04:48 AM   #3
kriezo
LQ Newbie
 
Registered: Jan 2008
Posts: 14

Original Poster
Rep: Reputation: 0
Talking

thanks digiot!!
no reason to preasure out till forgot the man page :-lol

anyway this is my edit command to get the ip :

grep -A 1 '[.][.][.] User unknown' maillog | egrep -o -e "[0-9]{2,3}\.[0-9]{2,3}\.[0-9]{2,3}\.[0-9]{2,3}"
 
  


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
SNMPv3 Unknown user name?! humbletech99 Linux - Server 0 07-30-2007 09:21 AM
why is maillog on my server getting created in /var/log/maillog.3 ? weblink_dipti Linux - Software 2 06-16-2007 04:47 AM
User Unknown Gnux *BSD 4 04-19-2006 01:04 PM
unknown user twallstr Linux - General 4 05-17-2005 12:20 PM
bash: lha unknown command or something like that Ermac6 Linux - Newbie 0 04-24-2001 08:05 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 01:07 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
Open Source Consulting | Domain Registration