LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   saving log information to a separate file (https://www.linuxquestions.org/questions/linux-general-1/saving-log-information-to-a-separate-file-46907/)

cuss 02-24-2003 10:00 AM

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

Mara 02-24-2003 10:57 AM

You can use
cat logfile|grep something >newfile
or
cat logfile|grep something >>newfile
(>> adds at the end, >erases old file content)

cuss 02-24-2003 11:04 AM

Thanks!

This also worked for me.

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

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


All times are GMT -5. The time now is 08:55 AM.