Append file commands for Unix & ex/vi

ucscb.bitbug at ucbvax.Berkeley.EDU ucscb.bitbug at ucbvax.Berkeley.EDU
Mon Jan 12 23:13:44 AEST 1987


>From: "John Wright/Dr. Pat Lane" <lane at dalcs.uucp>
>Date: 11 Jan 87 15:15:09 GMT
>Keywords: append command unix ex vi
>To:       info-unix at brl-sem.arpa

>
>
>Is there a way to append a range of text to a file from vi/ex (as opposed
>to 'w' which writes or over-writes)?

Yes. In escape mode, type

!<range>cat >> file<CR>

Where <range> is ! for present line,
		 G for to end of file,
		 } to end of paragraph, etc.


>
>Are there simple Unix commands to append files with syntax and action similar
>to 'cp' and 'mv'.  I developed the following alii and I'm wondering if they
>are necessary:
>	alias append cat !:1 >>!:2`test -d !:2 && echo /!:1`
>	alias tack append !:1 !:2 && rm !:1
>
>	(I would accept suggestions on a better name for the latter!)

With the append (>>) operator in sh and csh, I don't see why you would want
or need a command to append one file to another. The syntax it appears you
want is "append file1 file2". Such a program would be quite easy to write.
You already have.



More information about the Comp.unix.questions mailing list