LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
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.

Notices

Reply
 
LinkBack Search this Thread
Old 02-24-2003, 10:00 AM   #1
cuss
Member
 
Registered: Dec 2002
Posts: 63

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


Hi,

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?

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

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

Original Poster
Rep: Reputation: 15
Thanks!

This also worked for me.

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

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


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 On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are 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


All times are GMT -5. The time now is 11:05 PM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration