On Wed, 21 Dec 2022 at 04:18, Lee <[email protected]> wrote: > On 12/20/22, David <[email protected]> wrote:
> > $ echo -e '100:CD001\nXXX\n200:CD001' | awk 'BEGIN { FS=":" ; done=0 }
> > /CD001/ && done==0 { print $1 - 50 ; done=1 }'
> > 50
>
> You can do it without flags:
>
> $ echo -e '100:CD001\nXXX\n200:CD001' | awk -F: '/CD001/ { print $1 -
> 50 ; exit }'
> 50
That's better indeed. Thanks for sharing those improvements!
It really is worthwhile to know some basics of 'awk'.

