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

Michael Erskine msemtd at yahoo.co.uk
Tue Feb 1 16:35:54 GMT 2005


On Tuesday 01 February 2005 16:07, Johannes Kling wrote:

> 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

Full marks Jo! I guess that's "perldoc -q tabs".  

Good work... however :)  what I'm _REALLY_ curious about is a bash cl 
workaround "wrapper" for an in-place edit for those cl tools what don't have 
that feature. Here's what I finally came up with...

for file in *.[ch]; do expand -t 4 $file > t1; mv t1 $file; done

which _seems_ to have worked OK (I have backups!).

Regards,
Michael.

-- 
There's a fine line between courage and foolishness.  Too bad it's not a 
fence.



More information about the Nottingham mailing list