本文介绍了如何用一个以短划线/连字符开头的字符串进行grep?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想用文件中的 -X
开头的字符串命名,但是将其作为命令行参数感到困惑。
I want to grep for the string that starts with a dash/hyphen, like -X
, in a file, but it's confusing this as a command line argument.
我尝试过:
grep "-X"
grep \-X
grep '-X'
推荐答案
使用:
grep - -X
相关: (感谢)。
这篇关于如何用一个以短划线/连字符开头的字符串进行grep?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!