【发布时间】:2022-09-23 23:27:15
【问题描述】:
我想使用 grep 命令检查此字符串中是否存在空格后的 [200]
https://wwww.example.com/2000/file200.js [200]
https://wwww.example.com/2020/file201.js [404]
我试图 grep \"[200]\" 和 grep \"\\[200\\]\" 但他们都没有工作。
在用 grep 检查后我也需要保存链接,例如它会是这样的
cat links.txt | grep \"[200]\" > output.txt
output.txt 应该包含链接,而不是状态代码。
-
none of them worked是什么意思?是否有错误消息或不正确的输出?grep \"\\[200\\]\"在 GNU grep 上匹配。是不是匹配后要去掉状态码的问题?