Created
July 19, 2019 09:11
-
-
Save vbsteven/6fc93960111d4ab8a566d46b915f381f to your computer and use it in GitHub Desktop.
Prepend one file to another in bash
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
# this will find all folders with a file named versions.tf | |
# and prepend its contents to the file main.tf in the same directory | |
for p in $(find -name "versions.tf"); do | |
main=$(echo $p | sed 's/versions/main/' ); | |
echo -e "$(cat $p)\n\n$(cat $main)" > $main; | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment