Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 1 May 2015 22:26:34 +0100
From:      Mike Clarke <jmc-freebsd2@milibyte.co.uk>
To:        Alex Merritt <merritt.alex@gmail.com>
Cc:        Nancy Belle <belle@antennex.com>, freebsd-questions <freebsd-questions@freebsd.org>
Subject:   Re: Find and replace content in 100 lines
Message-ID:  <20150501222634.371373f0@curlew.lan>
In-Reply-To: <CADK3taLyW0sVoHQZ-pjm=VZUMj5Rnekz9jhvuLVyGV3DzHmYNw@mail.gmail.com>
References:  <DM__150430194617_07750665831@mail.antennex.com> <CADK3taLyW0sVoHQZ-pjm=VZUMj5Rnekz9jhvuLVyGV3DzHmYNw@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Fri, 1 May 2015 16:20:07 -0400
Alex Merritt <merritt.alex@gmail.com> wrote:

> You want sed with the search/replace feature, generally:
> 
> sed s/regular expression/replacement/flags
> 
> like so
> 
>  
> 's:"../../../arch1/arch14":"../../../../../../foo/foo2/foo3/arch1/arch14":g'
> input.html

Although that would almost certainly work OK in the OP's case  it would
be safer to use:

's:"\.\./\.\./\.\./arch1/arch14":"../../../../../../foo/foo2/foo3/arch1/arch14":g'

 otherwise if there was  something like "../../d1/arch1/arch14" it would
 become "../../../../../../foo/foo2/foo3/arch1/arch14" which is probably
 not what would be intended.

-- 
Mike Clarke



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20150501222634.371373f0>