Created
May 27, 2016 16:45
-
-
Save mrmurphy/10793df34e520f8cc9e5e1a0bbdb48d4 to your computer and use it in GitHub Desktop.
Insert a line at the beginning of files matching search pattern
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
# Requires siver-searcher to be installed | |
FILES=$(ag "<search term here, can be regex>" -l --js) | |
for i in $FILES; do | |
echo -e "<stuff to prepend here>\n$(cat $i)" > $i | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment