Created
December 20, 2017 12:06
-
-
Save ezk84/f27d5f2d2f614b6f87d301193620f04c to your computer and use it in GitHub Desktop.
List of useful bash snippets for common dev tasks.
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 | |
# rename files to lowercase | |
for F in `find -type f | grep -P '\/.*[A-Z]+.*$'`; do git mv $F ${F,,}; done; | |
# Search and replace: Use ack for Perl-style regexp pattern finding combined with sed for replacing | |
# Turn resource filenames mentions into lowercase | |
ack '(\w*[A-Z]+\w*\.(:?jpg|png|mp3|JPG|PNG|MP3))' src/ -o --noheading | \ | |
while IFS=":" read -r FILE LINE MATCH; do \ | |
sed -i "s/$MATCH/${MATCH,,}/" $FILE; | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment