Last active
November 10, 2015 07:50
-
-
Save ryanwild/bcc0bafa61d85b6dd3db to your computer and use it in GitHub Desktop.
Bash Examples
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
#!/bin/bash | |
VALUES="value1","value2" | |
(IFS=, | |
for v in $VALUES; do | |
echo "$v" | |
done | |
) |
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
#To append after the pattern: (-i is for inplace replace). line1 and line2 are the lines you want to append(or prepend) | |
sed -i '/pattern/a \ | |
line1 \ | |
line2' inputfile | |
#To prepend the lines before: | |
sed -i '/pattern/i \ | |
line1 \ | |
line2' inputfile |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment