Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Concatenating two log files 2

Status
Not open for further replies.

ddrillich

Technical User
Jun 11, 2003
546
US
Good Day,

I have these dynamically generated log files, except the most recent one - index.log. How can I concatenate the last renamed one (in this case index.log.19-Mar-10-19.44.57) with index.log.

[autonomy@sbkj2ksrchdihp01 logs]$ \ls -ltr ind*
-rw-r--r-- 1 autonomy text 1048592 Mar 17 00:06 index.log.17-Mar-10-00.06.21
-rw-r--r-- 1 autonomy text 1048596 Mar 17 00:07 index.log.17-Mar-10-00.07.48
-rw-r--r-- 1 autonomy text 1048655 Mar 17 09:22 index.log.17-Mar-10-09.22.09
-rw-r--r-- 1 autonomy text 1048629 Mar 17 14:09 index.log.17-Mar-10-14.09.36
-rw-r--r-- 1 autonomy text 1048593 Mar 17 20:37 index.log.17-Mar-10-20.37.14
-rw-r--r-- 1 autonomy text 1048639 Mar 18 00:06 index.log.18-Mar-10-00.06.39
-rw-r--r-- 1 autonomy text 1048602 Mar 18 07:53 index.log.18-Mar-10-07.53.11
-rw-r--r-- 1 autonomy text 1048670 Mar 18 12:30 index.log.18-Mar-10-12.30.18
-rw-r--r-- 1 autonomy text 1048618 Mar 18 17:22 index.log.18-Mar-10-17.22.04
-rw-r--r-- 1 autonomy text 1048634 Mar 19 06:03 index.log.19-Mar-10-06.03.04
-rw-r--r-- 1 autonomy text 1048648 Mar 19 12:18 index.log.19-Mar-10-12.18.12
-rw-r--r-- 1 autonomy text 1048663 Mar 19 19:44 index.log.19-Mar-10-19.44.57
-rw-r--r-- 1 autonomy text 48631 Mar 21 02:13 index.log

Much appreciated.

Regards,
Dan
 
You can use the concatenate command:

Code:
cat index.log.19-Mar-10-19.44.57 index.log > /tmp/concatenated.log

Or were you looking for a way to do this automatically regardless of the filename...?

Annihilannic.
 
Thank you Annihilannic,

Right, I do need to do this automatically regardless of the filename...

Regards,
Dan
 
Hurrah, a LUOC rather than an UUOC!!

The internet - allowing those who don't know what they're talking about to have their say.
 
Ok, UUOC stands for Useless Use of Cat. What is LUOC?

Regards,
Dan
 
Quite right, Annihilannic!

The internet - allowing those who don't know what they're talking about to have their say.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top