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

Johannes Kling jok at printk.net
Tue Feb 1 15:41:00 GMT 2005


Hello,

> #!/bin/bash
> for file in *.[ch] 
> do
>  expand -t 4 $file > t1
>  mv t1 $file
> done
> 
> ...I guess this probably worked (not checked yet! I'd like to grep for '\t' 
> but it doesn't seem to act like perl and grep -P says "not supported") but 
> I'm curious whether this "script" can be issued as a one-liner - anyone?

bash$ sed -i -e 's/\t/    /g;' *.[ch]

Should do roughly what you want. (Requires a fairly recent sed that
supports -i ; on Debian stable install ssed and use that instead if
the above fails).

Regards,
  Jo





More information about the Nottingham mailing list