I found this quite an interesting thought.
if of course the append operator, it will stick STDIN onto a file of your choice, so it gets added on the end.
Great! Everybody finds that useful.
But how about prepending?
I mean, sending some STDIN to the beginning of a textfile.
There seems to be a "forward" view to memory. It's OK to add and append stuff, but going backward, seems less conventional.
So, I thought about dong a little C program for this. But maybe this han been come across already. On first glance it may appear easy, but it may turn out in practice not to be.
echo "new first line" >newpendfile.txt && cat oldfile.txt >> newpendfile.txt && rm -f oldfile.txt
That's disgusting. IN perl, you could slurp the oldfile.txt and then print out, with the "new first line" coming first. I must admit, I would do the same with the C program. Read in the oldfile.txt first.