Any ideas?
tail -n filename will get the last n lines of file 'filename'
head -10 filename > tmpfile1
> the last 100 lines and put these into another file without losing any
tail -100 filename > tmpfile2
> spaces.
cat tmpfile1 tmpfile2 > resultfile
> I can't view the file using vi as the file is too big and when I use
> the tail command, it will not get the last 100 lines - it only
> retrieves the last 25 lines approx.
> Can't use the grep command either as I will then lose the spaces.
>
> Any ideas?
RTFM
man head
man tail
--
Dipl. Ing. Andreas Fenner, mailto:Andreas...@alcatel.de
Alcatel SEL AG, TS/EE, Holderäckerstr.10, 70499 Stuttgart, 0711/821-49823
-------------------------------------------------------------------------
Linux is like a Wigwam: no Windows, no Gates, Apache inside
use "tail -100" to get the last 100 lines and pipe it to the file you want
alexander
$ cat <(head -10 myfile) <(tail -100 myfile) > anotherfile
In Korn shell.
--
Tony Walton
> $ cat <(head -10 myfile) <(tail -100 myfile) > anotherfile
>
> In Korn shell.
I was going to vote for Andreas' response as being the best.
... until I saw this one!
-am © 2002
The other responders gave you the syntax for tail. If what you are saying
is for some reason your tail will not work with the correct options, you can
use sed to get specific lines from a file.
Anthony Mandic wrote:
>>$ cat <(head -10 myfile) <(tail -100 myfile) > anotherfile
>>
>>In Korn shell.
>
> I was going to vote for Andreas' response as being the best.
> ... until I saw this one!
Here's my entry, hope not too late (what's the prize?) :-)
$ (head -10 myfile; tail -100 myfile) > anotherfile
in any shell
Many versions of tail have a limit on the number of lines they can handle,
but I'm pretty sure this limit is usually larger than 100. Why don't you
show what you tried?
How long are the lines in the file? Tail may have problems with really
long lines, too.
If you can, use GNU tail. It's not likely to have any arbitrary limits.
--
Barry Margolin, bar...@genuity.net
Genuity, Woburn, MA
*** DON'T SEND TECHNICAL QUESTIONS DIRECTLY TO ME, post them to newsgroups.
Please DON'T copy followups to me -- I'll assume it wasn't posted to the group.