insert file?

Jacques B. jjrboucher at gmail.com
Wed Nov 28 23:09:37 UTC 2007


On Nov 28, 2007 3:40 PM, Mikkel L. Ellertson <mikkel at infinity-ltd.com> wrote:
>
> Alan Cox wrote:
> >> head -n 3 file;who;tail -n $(echo "$(wc -l file | cut -d " " -f 1) -3" |bc) file
> >
> > ( head -n3 file; who; tail +3 file) > newfile 2> errors
> >
> > Much easier ;)
> >
> I think you need to change "tail +3" to "tail -n +3" or tail will
> treat +3 as a file name.
>
>
> Mikkel
> --

No, that is the correct syntax.  No -n when telling tail to start at
the "N"th line.

tail -n 5
will give you the last five lines
tail +5
will start at the fifth line (according to man pages, so doesn't skip
5 lines - I tested it earlier but didn't pay close enough attention -
not in Linux now so can't test right now) and give you the rest of the
file

Jacques B.




More information about the fedora-list mailing list