Unix: prepending a file without a dummy-file?

hhh picture hhh · Mar 23, 2010 · Viewed 7.9k times · Source

I do not want:

$ cat file > dummy; $ cat header dummy > file

I want similar to the command below but to the beginning, not to the end:

$ cat header >> file

Answer

Mark Byers picture Mark Byers · Mar 23, 2010

You can't append to the beginning of a file without rewriting the file. The first way you gave is the correct way to do this.