[CentOS] awk global replacement only after keyword

Fri Mar 26 02:50:57 UTC 2010
Les Mikesell <lesmikesell at gmail.com>

Joseph L. Casale wrote:
>> Can you use a regexp like:
>> s/\(known_part\)\(.*\)\(change_part\)/\1\2replace_part/
> 
> Unless I misunderstand that, I'd say no.
> 
> The actual file might look this:
> 
> /begin file
> 
> foo bar{
> 	biz	service-one
> 	baz	service-two
> }
> 
> --many more of that--
> 
> # comment
> 
> fiz bir{
> 	aaa	service-one
> 	bbb	service-two
> }
> 
> /end file
> 
> So only after the "# comment", I want to then start replacing.
> I am just trying to replace a very ugly long set of commands piped into
> each other that I am using now.

I think there is a way to do it in sed using the holding space, but it's so much 
easier in perl that I never bothered to learn the hard parts.  What's the 
problem with using perl anyway?

-- 
   Les Mikesell
    lesmikesell at gmail.com