Created
December 1, 2015 14:11
-
-
Save colin-kiegel/b35d278d6ed5251dfa85 to your computer and use it in GitHub Desktop.
regex replace multi-line + in multiple files
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
$FILES="*.rs" | |
$REGEX="s#(.*)\n(.*)/\2\n\1/" | |
find . -name "$FILES" | xargs perl -0777 -pi -e '$REGEX' | |
# flag: -0777 tells perl to read the file as a whole | |
# replace '-pi' with '-pi.bak' to create backups |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment