用curl命令计数网站中的单词
我在网站上很有趣,我需要计算一个单词在HTTPS网站的主页上出现多少次,并且我使用了几个卷曲和GREP命令,但结果并不确切: curl -silent https://xxxxxx.com | grep -c你好 curl -silent https://xxxxxx.com | grep -c -i -w你好
I'm having fun counting words in websites, I need to count how many times a word appeared on the main page of https website and and I use a couple of curl and grep commands but the results are not exact :
curl --silent https://xxxxxx.com | grep -c hello
curl --silent https://xxxxxx.com | grep -c -i -w hello
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我通过使用卷发找到了解决方案,它返回网站的全部内容,GREP仅hello hello and wc来计算出现的数量。
curl https://wwwwwwwwwww.com/ | grep -io你好| WC
如果您还有其他我感兴趣的想法,例如使用Python,Web刮擦,使用其他Linux命令,例如使用命令WGET而不是Curl。
祝你周末愉快
I found the solution by using curl it returns the whole content of the website, grep only the word hello and wc to calculate the number of occurrences.
curl https://wwwww.com/ | grep -io hello | wc
If you have other ideas I'm interested, like using python, Web scraping, using other linux commands like use command wget instead of curl.
Have a nice week end