Skip to content

Instantly share code, notes, and snippets.

@carlosmcevilly
Last active October 11, 2015 03:48
Show Gist options
  • Save carlosmcevilly/3797982 to your computer and use it in GitHub Desktop.
Save carlosmcevilly/3797982 to your computer and use it in GitHub Desktop.
replace runs of four leading spaces with tabs in .m files
#!/bin/bash
# Bah. I prefer spaces. So why this script? I was on a project that required tabs.
export isconfirmed=$1
if [[ ! "$isconfirmed" == 'confirmed' ]]; then
echo 'run with a "confirmed" command line argument to confirm you want to run this destructive operation'
exit -1
fi
find . -type f -name "*.m" -print | xargs perl -pi -e "1 while s/\G {4}/\t/gc;" {} \;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment