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

Michael Erskine msemtd at yahoo.co.uk
Tue Feb 1 15:54:27 GMT 2005


On Tuesday 01 February 2005 15:42, Michael Erskine wrote:
> 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!

An explaination: I have a file called data1 with 2 rows of 3 columns...

michael at debian:~/lss/patched-code$ expand data1
hat     coat    scarf
premise tasters algebra

michael at debian:~/lss/patched-code$ sed -e 's/\t/        /g;' data1
hat        coat        scarf
premise        tasters        algebra

...so the expand appreciates the 8 char tabstops but sed just blits through 
doing what it's told!

This is what I'm trying to fix! This old C code has some pretty screwed up 
formatting in the comments due to dodgy tab expansion (not by me :) ).

Regards,
Michael.

-- 
The proof of the pudding is in the eating.
  -- Miguel de Cervantes



More information about the Nottingham mailing list