Re: awk global replacement only after keyword

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



>>Depends on how you define "one-liner."  Something like this might work:
>>
>>{ if index($0, PATTERN) != 0 {FOUND = 1;}; if (FOUND != 0)
>>{subst(REPLACE_THIS, WITH_THIS, $0); }
>>
>>You'd want to reverse the order of the two statements if the
>>replacement is only to occur after the pattern is found.
>
> Cool, I'll give it a whirl tomorrow! I do want to replace all
> occurrences only after the keyword

When you say "after", do you mean
blah, blah
blah, blah
yadda, yadda, keyword, to-be-replaced

or do you mean
blah, blah
blah, blah
yadda, yadda, keyword,
to-be-replaced
also-to-be-replaced?

         mark "awk 'r' us"


_______________________________________________
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