On 10/11/2011 05:27 PM, Chris Davies wrote:
On 10/11/2011 03:20 PM, John L. Cunningham wrote:johnc@infotech:~$ cat lazydog.awk /^The lazy dog/{ if ( count< 1 ){ print "The lazy dog is my favorite." count++ next } else { next } } { print }This works, but for those that are interested, and at the risk of making the script harder for some people to read, it can be simplified
<snip>
awk '/^The lazy dog/{if(!k++){print"The lazy dog is my favourite."};next}1'
Oooh, I like that! (except there appears to be a typo in "favorite" ;-) (wait, didn't we already do the British-American English off-topic thread?))
-- Kent