MLUG: Re: [MLUG] prepending a file
Re: [MLUG] prepending a file
Email address obfuscation in effect -- please click here to turn it off.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
On Tue, 2 Mar 2004, Brent Deterding wrote:

> I want to add some text to the top of a file - how do I do it?
>
> Like >> but at the beginning, not the end


Is the text in a file, or do you want to type it in?

typing it in and prepending to a file named "file":

cat > TEMP
(enter text followed by ctrl-D)
cat TEMP file > file2 ; \mv file2 file; \rm TEMP


prepending a file named "headfile" to a file named "file":

cat headfile file > TEMP ; \mv TEMP file


I'll bet you don't like that answer!  I don't think there's a slicker way.
If you have to do it often, you could write a little script to automate
some of that.

Mike
_______________________________________________
members mailing list
EMAIL:PROTECTED
http://mlug.missouri.edu/mailman/listinfo/members