有没有一种方法可以使;grepping";为了节省空间?
我经常使用grep进行搜索,比如有没有一种方法可以使;grepping";为了节省空间?,grep,space,windows-7-x64,Grep,Space,Windows 7 X64,我经常使用grep进行搜索,比如 grep -nr "matchFound[[:space:]]*=[[:space:]]*true" . 寻找类似 matchFound = true matchFound = true 但是为了节省空间,语法太冗长了。有没有可能让它不那么冗长 请注意:我在Windows 7上使用grep。通常,\s在正则表达式中相当于[\t\r\n]。不过,也可能有其他口味,但它们应该是异国情调。胡乱猜测:尝试双重转义:\\s。类似地,这
grep -nr "matchFound[[:space:]]*=[[:space:]]*true" .
寻找类似
matchFound = true
matchFound = true
但是为了节省空间,语法太冗长了。有没有可能让它不那么冗长
请注意:我在Windows 7上使用grep。通常,
\s
在正则表达式中相当于[\t\r\n]
。不过,也可能有其他口味,但它们应该是异国情调。胡乱猜测:尝试双重转义:\\s
。类似地,这在cygwin中也适用:$echo“matchFound=true”| grep-nr“matchFound\s*=\s*true”
给出了1:matchFound=true
。我会在cygwin上试用,然后给你回复。是的,这在cygwin上有效。我不知道在没有Cygwin的情况下如何才能让它工作,但谢谢你的回答。那个么,你们在使用什么样的grep
实用程序呢?
grep -nr "matchFound\s*=\s*true"