Created
July 10, 2016 20:35
-
-
Save chilismaug/0c43108187654a3cf1bfd8b1170faf6f to your computer and use it in GitHub Desktop.
bash prepend a header file into a file
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
assuming that the file you want to edit is my.txt | |
$cat my.txt | |
this is the regular file | |
And the file you want to prepend is header | |
$ cat header | |
this is the header | |
Be sure to have a final blank line in the header file. | |
Now you can prepend it with | |
$cat header <(cat my.txt) > my.txt | |
You end up with | |
$ cat my.txt | |
this is the header | |
this is the regular file | |
As far as I know this only works in 'bash'. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment