查找文件中的单词数 [英] find number of words in file
本文介绍了查找文件中的单词数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何查找该文件中任何位置都有xyz的单词.
前任. abxyzc.如何找到这个词.
我尝试过
猫的文件名| grep'* xyz *'| wc -l </pre>
但显示为0.
请帮助,非常紧急 解决方案
我尚未对此进行测试,但可以尝试一下:
grep -o -w'\< * xyz * \>' -f文件名| wc -w
string stringToCheck = text1";
字符串 [] stringArray = {" ," ," test1test2", test2text1"};
foreach (字符串 x in stringArray中的字符串)
{
如果(x.Contains(stringToCheck))
{
// 处理...
}
}
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
解决方案 I have not tested this, but give this a try:
grep -o -w '\<*xyz*\>' -f filename | wc -w
string stringToCheck = "text1";
string[] stringArray = { "text1", "testtest", "test1test2", "test2text1" };
foreach (string x in stringArray)
{
if (x.Contains(stringToCheck))
{
// Process...
}
}
这篇关于查找文件中的单词数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文