Re: help with regexp in gawk file

Kees Zeelenberg <[email protected]>
Newsgroups gmane.comp.windows.gnu.user
Message-ID <32A2B65F678B49F3BBD140A117B308F5@gamma>
This question does not seem to be related to the GnuWin32 port, and so I 
think it is best asked on a gawk mailing list.
See e.g. http://groups.google.com/group/comp.lang.awk

Kees Zeelenberg

--------------------------------------------------
Van: "Hane, Christopher A" <[email protected]>
Datum: dinsdag 28 april 2009 0:26
Aan: <[email protected]>
Onderwerp: [GnuWin32-Users] help with regexp in gawk file

>
> I am trying to remove all words in one list from another list of words.
> If I explicitly enumerate the words to remove everything works fine:
>     gsub(/to /, "",text);
>     gsub(/in /, "",text);
>     gsub(/or /, "",text);
>
> but if I try to build the list of words in an array no substitutions are
> ever done.  How can I properly format the text array to remove the
> words?
>
> Thanks!
>
> BEGIN{
>
> j=0;
>  badwords[j++]= "/<a> /";
> badwords[j++]= "/<the> /";
> badwords[j++]= "/<in> /";
>
>   text = "a fox jumped into and in the river";
> text2 = "a fox jumped into and in the river";
>
>  gsub(/\<a\> /, "", text);
>  gsub(/\<the\> /, "", text);
>  gsub(/\<in\> /, "", text);
>
> print text;
>
> for (i in badwords)
> {
>  gsub(badwords[i], "", text2);
>
> }
> print text2;
>
> exit(0);
> };
> {
> }
> END{}
>
> This e-mail, including attachments, may include confidential and/or
> proprietary information, and may be used only by the person or entity
> to which it is addressed. If the reader of this e-mail is not the intended
> recipient or his or her authorized agent, the reader is hereby notified
> that any dissemination, distribution or copying of this e-mail is
> prohibited. If you have received this e-mail in error, please notify the
> sender by replying to this message and delete this e-mail immediately.
> ------------------------------------------------------------------------------
> Register Now & Save for Velocity, the Web Performance & Operations
> Conference from O'Reilly Media. Velocity features a full day of
> expert-led, hands-on workshops and two days of sessions from industry
> leaders in dedicated Performance & Operations tracks. Use code vel09scf
> and Save an extra 15% before 5/3. http://p.sf.net/sfu/velocityconf
> _______________________________________________
> GnuWin32-Users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/gnuwin32-users 


------------------------------------------------------------------------------
Register Now & Save for Velocity, the Web Performance & Operations 
Conference from O'Reilly Media. Velocity features a full day of 
expert-led, hands-on workshops and two days of sessions from industry 
leaders in dedicated Performance & Operations tracks. Use code vel09scf 
and Save an extra 15% before 5/3. http://p.sf.net/sfu/velocityconf
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.