如何在Windows上的git bash(msy​​sgit)中完全运行grep?

siu*_*lki 5 grep git-bash

我想使用grep -o,但在git bash中没有-o选择.有没有办法grep在git bash中完全工作,就像它在linux bash shell中一样?

Pra*_*tla 2

grep 没有 -o 标志 http://pubs.opengroup.org/onlinepubs/9699919799/utilities/grep.html

您可以使用sed代替

  • 有一个 [GNU grep](http://www.gnu.org/software/grep/manual/grep.html#General-Output-Control),但它是一个 GNU 扩展。 (2认同)