[prev in list] [next in list] [prev in thread] [next in thread] 

List:       gentoo-user
Subject:    Re: [gentoo-user] Re: OT: global search and replace
From:       Andrew Ross <aross () westnet ! com ! au>
Date:       2004-09-10 11:27:31
Message-ID: 1094815651.8560.25.camel () localhost
[Download RAW message or body]

On Fri, 2004-09-10 at 14:23, Alexander Skwar wrote:
> Billy Holmes wrote:
> > Alexander W. Skwar wrote:
> > 
> > 
> >>>>	sed -i 's/oldhostname/newhostname/g' "${FILE}"
> >>>
> >>>perl makes this easier..
> >>
> >>In how far?
> > 
> > 
> > it takes care of the backup files for you, perl's -i does't create 
> > backups unless you specify an extension like -i.bak
> 
> Okay, and how does that differ from sed? If you'd read the man page
> of sed, you'd find:
> 
>        -i[suffix], --in-place[=suffix]
> 
>               edit files in place (makes backup if extension supplied)
> 
> No extension (==suffix), no backup.
> 
> > therefore, no need for a block of shell code to remove the tmp files. 
> > thus easier in this case means less work.
> 
> Yes. That block's redundant.

No, it's neccessary (at least on my system).

The comment explicitly says it is removing "temp" files, not backups.
For whatever reason, sed -i creates these (empty) files in the current
working dir

Cheers

Andrew


--
gentoo-user@gentoo.org mailing list

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic