LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Blogs > zhjim
User Name
Password

Notices



Rate this Entry

Merging two log files

Posted 11-14-2011 at 05:52 AM by zhjim

Today I needed to merge two log files in cronological together. Heres my way about.

copy the two files to one host. (scp file name@server:~userhome
get the hostname infront of each line. (sed -i s/^/hostname/g first_file; ...)
cat ./first_file ./second_file | sort -k 3 > ./new_log

-k in sort stands for key. In my turn the datetime was the third field.

Improvements:
Get some color into the diffrence hostsnames.
Posted in Uncategorized
Views 531 Comments 0
« Prev     Main     Next »
Total Comments 0

Comments

 

  



All times are GMT -5. The time now is 01:07 PM.

Main Menu
Advertisement

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