Skip to content

Instantly share code, notes, and snippets.

@ezk84
Created December 20, 2017 12:06
Show Gist options
  • Save ezk84/f27d5f2d2f614b6f87d301193620f04c to your computer and use it in GitHub Desktop.
Save ezk84/f27d5f2d2f614b6f87d301193620f04c to your computer and use it in GitHub Desktop.
List of useful bash snippets for common dev tasks.
#!/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