[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: insert file?



On Nov 28, 2007 3:40 PM, Mikkel L. Ellertson <mikkel 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.


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]