Re: replace string

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

 



--- On Sat, 10/25/08, Cameron Simpson <cs@xxxxxxxxxx> wrote:

> From: Cameron Simpson <cs@xxxxxxxxxx>
> Subject: Re: replace string
> To: yong321@xxxxxxxxx, "General Red Hat Linux discussion list" <redhat-list@xxxxxxxxxx>
> Date: Saturday, October 25, 2008, 7:33 PM
> On 25Oct2008 13:13, 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, which does the
> same kind of thing as
> Perl's -i (in place edit) option, with the same
> often-undesirable hard link
> breakage.
> -- 
> Cameron Simpson <cs@xxxxxxxxxx>

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.

Yong Huang


      

-- 
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