Check if string contains matched words.



Hi,
I'm looking for a script that checks if there are any words in a string that
match with words in a file.
Suppose I have a file filter.txt containing the words: white, green, red
And a string: "This apple is yellow".
The result should be:
echo "No match found";
Can someone help me with a piece of script to help me?
Regards.

.



Relevant Pages

  • Re: How to rewrite with awk?
    ... > I'm unfamiliar with tools such as sed & awk. ... Extract the string that matches a RE. ... This script will not only expand all the lines that say "include ... file) and not resetting ARGV(the tmp file), it then lets awk do any ...
    (comp.unix.shell)
  • Re: Slow string
    ... I see virtually no difference in execution time for the code you posted when using cscript versus using wscript; to confirm, I bracketed the code with an initial ... Are you actually entering the script name into a console window? ... You can use the exact same line for every wrapper script - and that includes wsf and js scripts; all you need to do is change the final "vbs" to "wsf" or "js" as appropriate. ... If you build a large string by small concatenations, the performance degrades geometrically - so does array resizing, because they both use the same nasty technique inherited from VB1 of copying the entire data structure to a new structure with the added element. ...
    (microsoft.public.scripting.vbscript)
  • Re: echo oddities...
    ... > The whole beginning of the string fails to print. ... > using PRINT instead of ECHO and get the same output. ... > this code from a much larger script and tested it on its own and I ... conversion to int because "+" is not a string operator... ...
    (php.general)
  • Re: Grep and mv
    ... > And the string I am extracting has no space at the end either. ... > od -tx1z does not show me any control characters either. ... > # echo ... running the script); post the EXACT error messages, ...
    (comp.unix.shell)
  • Re: Function that returns date of file.
    ... string after the date/time when it is used by itself. ... Is that your entire script? ... I make an IF statement that required the 'equals equals'. ... designed database your job will be all that much harder. ...
    (alt.php)