如何在在man命令中,使用扩展正则查找字符串?
发表于 : 2018-06-08 20:58
在一个命令的man页中,使用“/”可以查找字符串,但如果要使用扩展正则元字符时 \{m,n\} 。如何操作?
例如 man awk
如何查找以空白字符开头的 for循环语句的说明
例如 man awk
如何查找以空白字符开头的 for循环语句的说明
代码: 全选
update-alternatives --display pager
具体是哪个库,可以通过编译时的日志找到。比如对于64位的18.04系统,日志在 https://launchpadlibrarian.net/34778790 ... ING.txt.gz/pattern
Search forward in the file for the N-th line containing the pat‐
tern. N defaults to 1. The pattern is a regular expression, as
recognized by the regular expression library supplied by your
system. The search starts at the first line displayed (but see
the -a and -j options, which change this).
gnu库的正则功能可以选择不同的语法,要知道less用的哪个只能查源代码了regular expression library: gnu
代码: 全选
wget -q http://mirrors.aliyun.com/ubuntu/pool/main/l/less/less_487.orig.tar.gz -O- | tar -xzO less-487/pattern.c | grep -A5 -m1 HAVE_GNU_REGEX
代码: 全选
/\bfor\s+\(
代码: 全选
Basic vs Extended Regular Expressions
In basic regular expressions the meta-characters ?, +, {, |, (, and )
lose their special meaning; instead use the backslashed versions \?,
\+, \{, \|, \(, and \).