I want to add a line at the beginning and at the end of a file..
e.g.
echo "at the beginning.." > tmp_file &&
cat file >> tmp_file &&
echo "last line" >> tmp_file &&
mv tmp_file file
is there a nice way for doing that??
Thx
I want to add a line at the beginning and at the end of a file..
e.g.
echo "at the beginning.." > tmp_file &&
cat file >> tmp_file &&
echo "last line" >> tmp_file &&
mv tmp_file file
is there a nice way for doing that??
Thx
What about this..?
echo -e "Before the data\n $(cat file)\nEnd of data"
to add a line at beginning of file
sed '1 i this is first line' file
to add at end of file
sed '$ a this is last line' file