Looking for quick way of editing a text file

Robert Nichols rnicholsNOSPAM at comcast.net
Mon Nov 21 02:48:26 UTC 2005


cs at zip.com.au wrote:
> On 20Nov2005 19:31, gb spam <gbofspam at gmail.com> wrote:
> | > 2: You might want bsed:
> | >
> | >      Page:
> | >      http://www.cskk.ezoshosting.com/cs/css/bsed.html
> | >
> | >      Script:
> | >      http://www.cskk.ezoshosting.com/cs/css/bin/bsed
> | >
> | > Bsed is a wrapper for sed. It takes pretty well the same arguments as sed,
> | > but edits files in place. I frequently use it for batch edits; it's very
> | > handy. Example:
> | >
> | >         bsed '4s/that/that/' filename.txt
> | >
> | > Replace "this" with "that" on line 4. It essentially does all the redirection
> | > of the first sed with error handling, temp files and such.
> | 
> | check out "sed -i"
> 
> Only on GNU sed, not standard sed. And probably as busted as "perl -i"
> (see other post in thread). Bsed is easier to type anyway, and has a
> few other handy benefits like diff reporting.

I know very little about perl, but "sed -i" is definitely b0rken if
you give it a symlink to the actual file.  The original file remains
unchanged, and the symlink gets replaced by the updated file.

-- 
Bob Nichols         Yes, "NOSPAM" is really part of my email address.




More information about the fedora-list mailing list