针狗技术网

针狗技术网、电脑技术资源网

如何在文件中搜索术语?

avatar LLL769394 2024-07-27 08:12 331次浏览 0 条评论 技术

使用grep命令。

如果你想知道用户一词是否在/etc/httpd/conf/httpd.conf中,你可以运行

grep -i user /etc/httpd/conf/httpd.conf

(-i 使搜索不区分大小写)。

通常grep不会告诉你它找到该术语的行号。如果你想找出行号,运行

grep -n -i user /etc/httpd/conf/httpd.conf

发表评论