25 Jan
2001
25 Jan
'01
23:21
On Thu, Jan 25, 2001 at 09:44:17PM +0100, P.C. Uiterlinden wrote:
Martin Mielke wrote:
Dear all,
how can I append a text header to a plain-text file (source code) without deleting what's been already there?
I guess, the clue resides on 'man sed' but some examples will be much appreciated.
Here is a novel solution for you. Suppose you want to
prepend (I dont think you can append to the beginning of something)
Prepend contents of file1 before contents of file2
CF2=`cat file2`;cat file1 >file2;echo $CF2>>file2
Might be a limit to how much data a shell var will hold :)
Or more elegantly, suppose you have a bunch of 'c' files
and you want to prepend a file called header.
# prepend header to 'c' files
for FILE in *.c; do
ed -s $FILE <