Last active
January 30, 2019 15:28
-
-
Save chessai/999e4ef312e86ea77b7a2711d568d14b to your computer and use it in GitHub Desktop.
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
# recursively replace all occurrences of something. | |
find dir -type f -name '*.hs' -print0 | \\ | |
xargs -0 sed -i 's/Find/Replace/g' | |
# recursively remove all trailing whitespace | |
find dir -type f -print0 | \\ | |
xargs -0 sed -i 's/[ \t]*S//' | |
# recursively add newlines to the end of files that don't have them. | |
find dir -type f -print0 | xargs -0 sed -i -e '$a\' | |
# recursively change a 'oldString' which are in uncommented lines with | |
# 'newString', but respect comments at the end of a line. | |
# (Haskell style comments here, not hard to change) | |
find dir -type f -name '*.hs' -print0 | \\ | |
xargs -0 sed -i 's/^\([^--]*\)newString/\1oldString/' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment