Click here to Skip to main content
15,886,362 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,

How find words that have xyz anywhere in that file.

Ex. abxyzc. How to find this word.

I have tried
cat filename | grep '*xyz*' | wc -l


But it's showing 0.

Please help, very urgent
Posted
Updated 23-Nov-12 6:03am
v5

I have not tested this, but give this a try:
grep -o -w '\<*xyz*\>' -f filename | wc -w
 
Share this answer
 
v2
C#
string stringToCheck = "text1";
string[] stringArray = { "text1", "testtest", "test1test2", "test2text1" };
foreach (string x in stringArray)
{
    if (x.Contains(stringToCheck))
    {
        // Process...
    }
}
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900