LinuxQuestions.org
Did you know LQ has a Linux Hardware Compatibility List?
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 526 Comments 0
« Prev     Main     Next »
Total Comments 0

Comments

 

  



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

Main Menu
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