[Nottingham] Quick! I need a bash one liner!

Johannes Kling jok at printk.net
Tue Feb 1 16:08:09 GMT 2005


> > On Tuesday 01 February 2005 15:40, Johannes Kling wrote:
> > > bash$ sed -i -e 's/\t/    /g;' *.[ch]
> >
> > Good call, but substituting all tabs for four spaces isn't what expand -t 4
> > will do since expand compensates for real tabstops!

bash$ perl -i -pe 's/\t+/" " x (length($&) * 8 - length($`) % 8)/ge;' *.[ch] # from perldoc -q

Only technicially bash and only technicially a one liner, but...

I give up otherwise :-).

Regards,
  Jo



More information about the Nottingham mailing list