Created
June 28, 2017 04:02
-
-
Save sevaine/c6e34482332f364f7e39d7254316dafb to your computer and use it in GitHub Desktop.
insert multi-line string before or after match with sed
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
# insert before match | |
sed -i '/PATTERN/ s|^|LINE1\nLINE2\nLINE3\n|' FILE | |
# insert after match | |
sed -i '/PATTERN/ s|$|\nLINE1\nLINE2\nLINE3|' FILE |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment