A. There is no prepend operator, however there are many ways to do the same. You can use ed, sed, perl, awk and so on.
Prepend a text using a temporary file
Here is simple solution using a temporary file to prepend text:echo 'line 1' > /tmp/newfileHere is one line solution:
echo 'line 2' >> /tmp/newfile
cat yourfile >> /tmp/newfile
cp /tmp/newfile yourfile
echo "text"|cat - yourfile > /tmp/out && mv /tmp/out yourfile
No comments:
Post a Comment