Skip to content

Instantly share code, notes, and snippets.

@lolgear
Created September 29, 2019 11:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lolgear/c97166efffcf86026f8d0ce5fda306a1 to your computer and use it in GitHub Desktop.
Save lolgear/c97166efffcf86026f8d0ce5fda306a1 to your computer and use it in GitHub Desktop.
Shell command to replace tabs with spaces ( 4 count in example ) in files matching pattern ( swift files )
find . -name '*.swift' | perl -ple 's/ /\\ /g' | xargs perl -i -lpe 's/^\t/ /g'
@lolgear
Copy link
Author

lolgear commented Sep 29, 2019

Use instead

find . -name '*.swift' | perl -ple 's/ /\\ /g' | xargs perl -MText::Tabs -i -lne '$tabstop = 4; print expand($_)'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment