Operating System - HP-UX
1833831 Members
2432 Online
110063 Solutions
New Discussion

Last lines in the fileself

 
SOLVED
Go to solution
Oscar Paredes Alvarez
Occasional Advisor

Last lines in the fileself

Hi,

We have one process and generated file log.
This file log contain 3412312 lines and is necesary for futures review.

I need compress this file log and only less the
last 10000 lines...

Any sugestion ?...
Thanks ....
5 REPLIES 5
Henk Geurts
Esteemed Contributor
Solution

Re: Last lines in the fileself

hi Oscar

similar thread with good solutions:
http://forums1.itrc.hp.com/service/forums/questionanswer.do?threadId=426892

regards,
Henk
Muthukumar_5
Honored Contributor

Re: Last lines in the fileself

You can extract last 10000 lines from that log file and put into another file. Remote / archive the original log file.

1. tail 10000 >
2. Using awk / sed + wc we can do it.
Easy to suggest when don't know about the problem!
Pete Randall
Outstanding Contributor

Re: Last lines in the fileself

Be aware that tail will very likely fail because it is limited by the 20K buffer it uses. From the man page:

"WARNINGS Tails relative to end-of-file are stored in a 20-Kbyte buffer, and thus are limited in length."


Pete

Pete
Gopi Sekar
Honored Contributor

Re: Last lines in the fileself


use the tail command. eg: tail -n 10000 file

if it proves to be failing then write a program of your self which seeks to end of file and reads the line in reverse.

Hope this helps,
Gopi
Never Never Never Giveup
Oscar Paredes Alvarez
Occasional Advisor

Re: Last lines in the fileself

Thanks.

The comments are importants...