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

Re: OT: merge two files



Le samedi 21 Août 2004 22:11, Nicholas Lativy a écrit :
> On Sat, Aug 21, 2004 at 09:42:15AM -0500, Kent West wrote:
> > I want to merge the contents of one file with the bottom X lines of
> > another. This works:
> >
> > cat file1 > EndResultFile && tail +20 file2 >> EndResultFile
> >
> > Is this adequate, or is there a better way to do it?
>
> Well I don't know if it's "better" but you could do it in less
> characters if you use a command group, ie
>
> (cat file1 && tail +20 file2) > EndResultFile
>

The disadvantage of this solution, is that you create a new process (a new 
shell) just for the redirection.

Just look :

nicolas@conchita:~$ ps ; echo
  PID TTY          TIME CMD
 4163 pts/1    00:00:00 bash
 4297 pts/1    00:00:00 ps

nicolas@conchita:~$ (ps ; echo)
  PID TTY          TIME CMD
 4163 pts/1    00:00:00 bash
 4303 pts/1    00:00:00 bash
 4304 pts/1    00:00:00 ps

nicolas@conchita:~$

Nicolas.



Reply to: