On Sat, 21 Sep 2013 12:00:54 -0400 Albretch Mueller <lbrt...@gmail.com> wrote:
> I have come to believe this is one of those problems that is not to > be optimally solved with a script, but a programming language > > lbrtchx > > Probably AWK could be a good compromise :) words.awk: BEGIN { split(p,ws,"|"); n=1; while (n in ws) ff[n++]=0; } { for (i=1;i<n;i++) if ((ff[i]==0) && (match($0,ws[i]))) ff[i]=1; } END { f=0; i=1; while ((f==0)&&(i<n)) { if (ff[i++]==0) f=1; } exit(f); } command line: $ awk -v p="w1|...|wn" -f words.awk file.txt Regards :) -- http://mr.flossdaily.org -- 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/20130923134723.7b828...@eunet.rs