Re: awk global replacement only after keyword

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



> Trying to avoid a perl script which wouldn't be hard, but I am looking
> for an awk one liner that does a replacement, but only after it sees a
> key word on some line.
>
> Anyone know of that's easy to do?

{if ( $0 ~ /<keyword>/) (sub(str, repl);} print $0;}

      mark

_______________________________________________
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