我偶然发现了命令
du -xh / | grep -P "G\t"我对开关-P of grep感兴趣,它是做什么的。另外,有人能解释一下"G\t"部件是干什么的吗?
请不要解释du -xh或命令grep的基本知识。
$ du -xh / | grep -P "G\t"
5.1G /var/oracle/XE/datafile
5.1G /var/oracle/XE
5.1G /var/oracle
1.1G /var/lib
6.9G /var
1.9G /opt/softwareag/webMethods/install/fix
1.9G /opt/softwareag/webMethods/install
1.2G /opt/softwareag/webMethods/Designer
1.3G /opt/softwareag/webMethods/common
1.9G /opt/softwareag/webMethods/CCE
1.2G /opt/softwareag/webMethods/IntegrationServer/instances/default/replicate/salvage
3.0G /opt/softwareag/webMethods/IntegrationServer/instances/default/replicate
2.3G /opt/softwareag/webMethods/IntegrationServer/instances/default/packages
5.5G /opt/softwareag/webMethods/IntegrationServer/instances/default
5.5G /opt/softwareag/webMethods/IntegrationServer/instances
5.7G /opt/softwareag/webMethods/IntegrationServer
16G /opt/softwareag/webMethods
16G /opt/softwareag
16G /opt
1.1G /usr/share
3.0G /usr
11G /u01/app/oracle/oradata/XE
11G /u01/app/oracle/oradata
12G /u01/app/oracle
12G /u01/app
12G /u01
39G /发布于 2019-06-18 10:15:23
-P支持与Perl兼容的regex引擎,这不是默认的.在您的示例中,需要将\t作为选项卡符号处理。
否则,grep将把它视为一个普通的t (用\转义)。
你可以很容易地根据手册页找出这一点:
选项<...>
匹配器选择
<...>
-P,--perl-regexp将模式解释为Perl兼容的正则表达式(. )--这是实验性的,grep -P可能会警告未实现的特性。
https://unix.stackexchange.com/questions/525605
复制相似问题