Last active
August 28, 2017 22:50
-
-
Save ErvalhouS/eae903707bdb739f5cf23e3dbdc360ea to your computer and use it in GitHub Desktop.
Adding new script line to files contained in folder after regex match
This file contains hidden or 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
#!/bin/bash | |
FILES=/path/to/folder/* | |
for file in $FILES | |
do | |
sed -i "/my-complex-regexp-finder/a content-to-add" $file | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The "/a" makes the content to add be a new line on the file.