Linux Bash: Append and Prepend Strings to Files
I want to append the string “BYE” to the file test.txt
echo “BYE” >> test.txt
Now, I want to prepend the string “HI” to the file test.txt
echo “HI”|cat - test.txt > /tmp/out && mv /tmp/out test.txt
I want to append the string “BYE” to the file test.txt
echo “BYE” >> test.txt
Now, I want to prepend the string “HI” to the file test.txt
echo “HI”|cat - test.txt > /tmp/out && mv /tmp/out test.txt
You must be logged in to post a comment.