I can do
cat file.txt to get the contents of a file but I also want to tack on a final line of my own choosing.
I tried piping
(cat file.txt ; echo "My final line") | but only the final line is getting passed through the pipe. How can I join the cat and final line?
Edit for a point of clarification: I do not wish to modify the file itself. I am aware that if this were the case I could do
echo "My final line" >> file.txt or
echo "My final line" | tee -a file.txt but I am only trying to do the append within the context of this particular command so I can pipe in the concatenation of
"My final line".
echo "My final line" >> file.txt?
>>if I wanted to edit the file itself.
file.txt? Your pipe snippet should work.