Re: replace string

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 25Oct2008 18:05, Yong Huang <yong321@xxxxxxxxx> wrote:
| > | > From: "Mad Unix" <madunix@xxxxxxxxx>
| > | > find /dir -name "*.html" -exec sed i 's/"old"/"new"/g' {} \;
| > | Even if you get your sed command right, that won't do in-place
| > | replacement, because if you use sed, the result has to be saved to a
| > | different file and you mv that file to overwrite your original file.
| > 
| > He is trying to use GNU sed's -i option, [...]
| Thanks, Cameron. My knowledge of sed got stuck at the O'Reilly book
| "sed and awk" and didn't realize the GNU version had many more options. I
| found my book on the shelf. It was published in 1997.

I try to stick to the same usage as you (and, indeed, the same book!)

I just happen to know the GNU sed has some extra stuff because I see
people using it. Personally, I avoid it (extra non-portable features)
unless I really gain a large benefit from it; as soon as you use such
things you are stuck when you go to another system which doesn't use the
GNU tools, and also you start to forget the portable way and write more
and more stuff that doesn't port.

Cheers,
-- 
Cameron Simpson <cs@xxxxxxxxxx> DoD#743
http://www.cskk.ezoshosting.com/cs/

(about SSSCA) I don't say this lightly. However, I really think that the U.S.
no longer is classifiable as a democracy, but rather as a plutocracy.
- H. Peter Anvin <hpa@xxxxxxxxxxxxxxx>

-- 
redhat-list mailing list
unsubscribe mailto:redhat-list-request@xxxxxxxxxx?subject=unsubscribe
https://www.redhat.com/mailman/listinfo/redhat-list

[Index of Archives]     [CentOS]     [Kernel Development]     [PAM]     [Fedora Users]     [Red Hat Development]     [Big List of Linux Books]     [Linux Admin]     [Gimp]     [Asterisk PBX]     [Yosemite News]     [Red Hat Crash Utility]


  Powered by Linux