[SunHELP] insert one line at beginning of text file; efficiently
sunhelp at sunhelp.org
sunhelp at sunhelp.org
Tue Sep 2 16:51:34 CDT 2003
I need to insert a line at the beginning of text files and would like to
know if the following would be the most efficient way of doing so.
$ cat test.txt
This is the original test data.
$ echo "new line" > tmp.new
$ cat test.txt >> tmp.new
$ mv tmp.new test.txt
$ cat test.txt
new line
This is the original test data.
This code will be intercepting print data which could be lengthy and
that is why I am concerned with efficiency. If I have to go with temp
files I will add a time stamp to avoid multiple tasks overwritting
each other.
TIA
Solaris 8
More information about the SunHELP
mailing list