Created
April 6, 2015 22:34
-
-
Save bennylope/fad68f49bd4277ee1c69 to your computer and use it in GitHub Desktop.
Insertion shell script for prepending text to 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
#!/usr/bin/env sh | |
# | |
# Prepend the text from file in argument $1 to file in argument $2 | |
# | |
# | |
# Usage, inserting license front matter into all Python files in a directory, | |
# including subdirectories: | |
# | |
# find . -name "*.py" -print0 | xargs -0 -n 1 ./prepend.sh frontmatter.txt | |
FRONTMATTER=$(cat $1) | |
CODEFILE=$(cat $2) | |
echo "$FRONTMATTER\n\n$CODEFILE" > $2 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment