View the Most Wanted LQ Wiki articles.
Go Back > Forums > Linux Forums > Linux - Software
User Name
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.


  Search this Thread
Old 05-08-2006, 10:37 AM   #1
Registered: Sep 2005
Location: California
Distribution: Slackware & Debian
Posts: 264

Rep: Reputation: 30
Arrow Filter Search Results


I have been running a little server for a while, and i am wondering how many people have used it. The server creates crappy logfiles.

I am trying to find the command which would allow me to print only the matching characters per line in the input file and follw each result with a line break.

The results therefore should look something like this (a list of all ip addresses from a bunch of crappy logfiles):
and so on.

I was thinking about a program which matches something like this:
(I hope the above regular expression is correct. It should match all numbers in the following pattern nnn.nnn.nnn.nnn

The program is only supposed to print matches of the expression, not the entire line of its context.


Last edited by wwnexc; 05-08-2006 at 10:41 AM.
Old 05-08-2006, 11:06 AM   #2
Registered: May 2006
Posts: 32

Rep: Reputation: 15
Try this:
grep -o '[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}' /var/log/mylog.log
dmesg | grep -o '[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}'

you must have the slashes and single quotes.

Last edited by frankjoshua; 05-08-2006 at 11:09 AM.


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
How do list the results from my search form? Alexander.s Programming 4 05-09-2005 11:01 AM
Search results page header lhoff LQ Suggestions & Feedback 4 09-14-2004 09:09 AM
The new Search Results page is not as good as the old one ? qwijibow General 2 07-25-2004 03:31 PM
search within results toastermaker LQ Suggestions & Feedback 1 11-20-2003 01:11 AM
Apollon: no search results m00nd0g Linux - Software 1 07-26-2003 05:06 PM

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