Eric Goodwin

Convert tabs to spaces in your project
09/03/02

find . -type f -exec perl -i -pe 's/\t/  /g' \{\} \;

2 comments

Comments

  1. 09/03/03 - xyz Says:

    Old school way:

    find . -type f -print0 | xargs -0 sed -i ’s/\t/ /g’

  2. 09/03/03 - Stéphan K. Says:

    Hmmm… My first thought was always to use ‘expand’, but it’s clumsy because it doesn’t have an in-place mode:

    for x in `find . -type f`; do expand -t 2 $x > $x.expanded; mv $x.expanded $x; done

    And I suppose that breaks on filenames with spaces. :)

About

Eric Goodwin is a web developer living in Victoria BC, Canada. You can contact him at eric@ericgoodwin.com

Open Source

Projects

Elsewhere

Archives