Re: awk global replacement only after keyword

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



Joseph L. Casale wrote:
>> sounds more like a reason to use sed
>>
>> man sed or tell us exactly what you are trying to do
> 
> Tell you the truth, I would much rather use sed, but I didn't think
> that was doable with it.
> 
> I have a slew of txt files that contain a keyword like "service-one"
> on many lines. I need to change those, but only the ones that appear
> _after_ a known comment.

Can you use a regexp like:
s/\(known_part\)\(.*\)\(change_part\)/\1\2replace_part/

-- 
   Les Mikesell
    lesmikesell@xxxxxxxxx


_______________________________________________
CentOS mailing list
CentOS@xxxxxxxxxx
http://lists.centos.org/mailman/listinfo/centos

[Index of Archives]     [CentOS]     [CentOS Announce]     [CentOS Development]     [CentOS ARM Devel]     [CentOS Docs]     [CentOS Virtualization]     [Carrier Grade Linux]     [Linux Media]     [Asterisk]     [DCCP]     [Netdev]     [Xorg]     [Linux USB]
  Powered by Linux