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

Re: [SLUG] search and replace



On Tue, 27 Jun 2000, Dean Hamstead wrote:

> Is there a command in vi or somesuch standard cli editor to search and
> replace
> 
> in my case change all ".org" entries to ".com" in the dns files
> im sure awk or seomthing can do it also....

In vi you can use:

%s/\.org/.com/g

(for every line, replace every literal .org with .com)

But this requires loading each file (I'm not a vi* user, so there might be
a way of doing it)

Perl has a handy in-place edit feature:

perl -i.bak -pe 's/\.org/.com/g' files ...


--
SLUG - Sydney Linux Users Group Mailing List - http://www.slug.org.au
To unsubscribe send email to slug-request@nospam.slug.org.au with
unsubscribe in the text