TABs (was: Waffling between Python and Ruby)

Kai Großjohann Kai.Grossjohann at CS.Uni-Dortmund.DE
Sun Jun 18 12:29:37 EDT 2000


hzhu at mars.localdomain (Huaiyu Zhu) writes:

> This is simple to do for one file, but not for many files.  I'd prefer
> running something in batch mode on a list of files.

There are Unix programs `expand' and `unexpand'.  Presumably, running
the following commands on a file foo would change tab stops from 4 to
8:

    expand -4 foo > foo.new
    unexpand -8 foo.new > foo
    rm -f foo.new

You could easily do this in a loop:

    for f in *.c
    do
        expand -4 $f > $f.new
        unexpand -8 $f.new > $f
        rm -f $f.new
    done

Does this help?

kai
-- 
I like BOTH kinds of music.



More information about the Python-list mailing list