[CentOS] awk global replacement only after keyword

Joseph L. Casale jcasale at activenetwerx.com
Fri Mar 26 03:20:06 UTC 2010

>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

More information about the CentOS mailing list