Issue
Is there a Unix command to prepend some string data to a text file?
Something like:
prepend "to be prepended" text.txt
id='dv3'>
Solution
sed -i.old '1s;^;to be prepended;' inFile
-i
writes the change in place and take a backup if any extension is given. (In this case,.old
)1s;^;to be prepended;
substitutes the beginning of the first line by the given replacement string, using;
as a command delimiter.
Answered By - Prince John Wesley Answer Checked By - Pedro (WPSolving Volunteer)