On Wed, Oct 12, 2011 at 6:50 AM, Kent West <we...@acu.edu> wrote: > 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?)) >
Try perl, it's lovely too. perl -ne 'print $_ unless (s/^(The lazy dog).*/$1 is my favorite./ and $k++)' Alexey Salmin -- To UNSUBSCRIBE, email to debian-user-requ...@lists.debian.org with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org Archive: http://lists.debian.org/CAKt1OCTX4mQ667vM0Q5V5Pr=suv_+3p4+iytds0jpct97un...@mail.gmail.com