Visit Jeremy's Blog.
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 02-24-2003, 10:00 AM   #1
Registered: Dec 2002
Posts: 63

Rep: Reputation: 15
saving log information to a separate file


I want to run 'grep' to parse out thousands of log files based on an IP address, and save this output to another file so that I can export it to another server. How would I go about doing this? Is there a command i can issue to work in conjunction with grep that will save this output to a separate file?

Old 02-24-2003, 10:57 AM   #2
Registered: Feb 2002
Location: Grenoble
Distribution: Debian
Posts: 9,696

Rep: Reputation: 232Reputation: 232Reputation: 232
You can use
cat logfile|grep something >newfile
cat logfile|grep something >>newfile
(>> adds at the end, >erases old file content)
Old 02-24-2003, 11:04 AM   #3
Registered: Dec 2002
Posts: 63

Original Poster
Rep: Reputation: 15

This also worked for me.

[root@xxxx]# grep 'something' 'logfile' > newfile

Good to know about the difference between '>>' and '>'.


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
Changing on which log information is saved Pastorino Linux - Software 0 09-23-2005 07:56 AM
saving settings after log out begby Linux - Software 2 03-18-2005 04:43 PM
Saving Complex Information in Files gamehack Programming 9 09-11-2004 01:05 PM
Log failures to a separate file nielchiano Linux - General 0 02-17-2004 03:59 PM
log information - newbie SoCalVP Linux - General 3 01-09-2003 11:45 PM > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 10:40 AM.

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
Open Source Consulting | Domain Registration