相关疑难解决方法(0)

可以为标签git grep吗?

此问题指定-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?

git grep

36
推荐指数
2
解决办法
3289
查看次数

使用'grep'搜索没有-P的标签

grep -P以前成功使用过,直到我得到一台机器,其中grep不是用Perl正则表达式支持编译的.现在我无法匹配标签: \t字符,

grep -G '\t' matches a literal 't'
grep -E '\t' matches a literal 't'
Run Code Online (Sandbox Code Playgroud)

我如何匹配标签?

regex grep

10
推荐指数
1
解决办法
6825
查看次数

用于计算整个文件中单词出现次数的命令

我试图计算文件中单词的出现次数.

如果一行中出现多次单词,我将计算为1.

以下命令将为我提供输出,但如果行有多次出现单词,则会失败

grep -c "word" filename.txt
Run Code Online (Sandbox Code Playgroud)

有没有一个班轮?

bash shell grep

3
推荐指数
1
解决办法
1万
查看次数

标签 统计

grep ×3

bash ×1

git ×1

regex ×1

shell ×1