Thanks for all your replies! It seems that a solution with echo command combine all lines to a one line. Is there a way to get around this?
$echo '<pre>' . `cat fruits` > myfruits
$cat fruits
apples
oranges
bananas
pears
$cat myfruits
<pre> . apples oranges bananas pears
$
With sed solution, I get a long error message as shown below.
$sed -i 1i"<pre>" fruits
sed: invalid option -- i
Usage: sed [OPTION]... {script-only-if-no-other-script} [input-file]...
-n, --quiet, --silent
suppress automatic printing of pattern space
-e script, --expression=script
add the script to the commands to be executed
-f script-file, --file=script-file
add the contents of script-file to the commands to be executed
--help display this help and exit
-V, --version output version information and exit
If no -e, --expression, -f, or --file option is given, then the first
non-option argument is taken as the sed script to interpret. All
remaining arguments are names of input files; if no input files are
specified, then the standard input is read.
E-mail bug reports to:
bug-gnu-utils@gnu.org .
Be sure to include the word ``sed'' somewhere in the ``Subject:'' field.