1846187 Members
3996 Online
110254 Solutions
New Discussion

Re: tail command

 
SOLVED
Go to solution
Simon R Wootton
Regular Advisor

tail command

I have a file which is 275,000 lines long and I only want the last 25,000 so I can put then in Excel for analysis. How can I get them using the tail command ?
7 REPLIES 7
Anu Mathew
Valued Contributor
Solution

Re: tail command

Hi Simon,

Use

tail -n 25000
Hope this helps,

Thanks

Anu Mathew
S.K. Chan
Honored Contributor

Re: tail command

$ tail -n 25000

Do "man tail" for details of available option.
Sanjay_6
Honored Contributor

Re: tail command

Hi,

Try

tail -25000 file_name > new_file_name

Hope this helps.

Regds
A. Clay Stephenson
Acclaimed Contributor

Re: tail command

tail -n 25000 infile > outfile
If it ain't broke, I can fix that.
Tom Maloy
Respected Contributor

Re: tail command

You can try

tail -25000 inputfile

You might prefer to use split instead:

split -250000 inputfile

and import the file "xab" into Excel.

Tom
Carpe diem!
Simon R Wootton
Regular Advisor

Re: tail command

Thanks to all - I sorted it 20 secs after leaving the forum !
James R. Ferguson
Acclaimed Contributor

Re: tail command

Hi SImon:

'tail' will not handle very large files. You can use 'sed' to mimic 'head' and 'tail'. For example:

# sed -e '1,5d' myfile #...removes lines 1-5

# sed -e '1,5!d' myfile # ...keeps only lines 1-5

Regards!

...JRF...