Last active
December 16, 2015 11:19
-
-
Save leemour/5426806 to your computer and use it in GitHub Desktop.
Regex to replace end in config files through bash
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
class Test | |
def procedure | |
nil | |
end | |
end | |
I am trying to achieve this: | |
class Test | |
def procedure | |
nil | |
finish | |
finish | |
sed -i '/end$/{N; s/end\nend/finish\nfinish/}' test.rb | |
sed -i '/end$/N;/\nend/s/end/finish/g' test.rb | |
sed -i '/end$/N;//s/end/finish/g' test.rb |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment