Append file commands for Unix & ex/vi

John Cornelius jc at piaget.UUCP
Tue Jan 13 02:07:25 AEST 1987


In article <2333 at dalcs.UUCP> lane at dalcs.UUCP (John Wright/Dr. Pat Lane) writes:
:
: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)?
:
: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!)
:
:Many thanks.

The VI document suggests that "Sometimes it is necessary to
append iformation onto the end of a file that already exists.
For example, if you wanted to append several lines to the file
'save', you could use the command:

	:12,25w >>save

"The editor will display the name of the file 'save', the number
of lines, and the number of characters added to the file."

-- 
John Cornelius
(...!sdcsvax!piaget!jc)



More information about the Comp.unix.questions mailing list