[Tutor] [Off-Topic] 'ex' vs. 'sed'...
زياد بن
زياد بن
Thu Feb 28 17:30:47 CET 2008
(sorry for hijacking the thread like this!)
On Wed, 2008-02-27 at 15:02 -0800, Bill Campbell wrote:
<snip>
> Another way on *nix systems that might be better wouldn't use
> python at all. Edit the file in place with ed or ex:
>
> #!/bin/sh
> ex - filename <<DONE
> 1d
> w
> q
> DONE
>
Errrr, how about: "sed -i.BACKUP -e '1d' filename"?
Much shorter, elegant, and obvious. (and it creates a backup file of
the original.)
After all, "sed" stands for: Stream EDitor.
Ziyad.
(again, sorry for hijacking the thread.)
More information about the Tutor
mailing list