如何将 regEx 与 grep 一起使用,以便检查我要查找的内容是否是该行的第一个内容?我想做的是在文件中查找单行注释,但我不想 grep stuff line http://path ,因此//后面不能有任何内容。
最佳答案
$ echo $'http://www.example.com\n // single line comment' | grep "^ *//.*"
// single line comment
关于regex - Grep 获取单行注释,但排除 http ://example. com 等内容,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9153170/