此问题指定-P允许GNU grep为选项卡grep
grep -P '\t' config/file.txt
Run Code Online (Sandbox Code Playgroud)
但是,使用git grep,我无法弄清楚如何grep选项卡:
git grep '\t' # Looks for files with the letter "t" instead
git grep -P '\t' # Invalid option
git grep -E '\t' # Does the same as without the -E
Run Code Online (Sandbox Code Playgroud)
似乎没有替代你自己的grep计划的选择.我唯一的选择是啜饮整个内容然后在结果上使用GNU grep?
Cas*_*bel 41
您可以通过在命令中键入文字选项卡来解决此问题:
# type it with ^V then tab
git grep ' '
Run Code Online (Sandbox Code Playgroud)
Ari*_*zis 34
我找不到一个正常工作的标签的正则表达式,但如果你可以传入一个标签,它会愉快地搜索一个文字标签.在bash,那将是
git grep $'\t'
Run Code Online (Sandbox Code Playgroud)