@Acer
echo -e "users:(("postgres",pid=1644,fd=3))" | grep -oP '(?<=pid=).*(?=,)'
-o
only
-P
perl-regexp
grep -options PATTERNS
PATTERNS
'......'
I didn't find definitions about this.
(...)
Grouping with Parentheses
(?=pattern)
is a positive look-ahead assertion
(?<=pattern)
is a positive look-behind assertion
I have one I cannot understand
what's the difference between
PATTERNS
and
'PATTERNS'
@Acer
Whenever you use a grep regular expression at the command prompt, surround it with quotes, or escape metacharacters (such as & ! . * $ ? and \) with a backslash (\).