Mr. Zimmerman,

try typing the following:
grep --help
also try:
man grep

Note that both say that -P enables perl regular expressions. Here's a simple 
grep to print out all the UUIDS assigned in my fstab:
grep -o 'UUID=[-A-Za-z0-9]* ' /etc/fstab

It prints out this list:
UUID=ffdd991f-2fb5-4f7c-b45b-3d1923044e88 
UUID=41fbf61a-6c4c-4a23-8864-d7a59d111a4e 
etc

That's great. Now, I don't want to match the UUID= , as I'm using this in a 
script. So, I go ahead and enable perl regular expressions, and use lookbehind:
grep -oP '(?<=UUID=)[-A-Za-z0-9]* ' /etc/fstab

And, guess what? I get this:
grep: The -P option is not supported

That's a bit of a contrived example, but I found this bug for a very
similar reason to the one I just described. Perl regular expressions
aren't compiled in, even though both the man and --help say it is.
That's a bug. Missing Perl Regex support is inconsistent with upstream's
--help and man page at best, and breaks scripts (and admins) at worst.
Sure, there are workarounds, but nothing quite matches the convenience
of grep.

I'm glad that the Technical Board approved the change in regards to
policy. That said, I respectfully disagree with this bug being demoted
to wishlist. Hopefully I'll remember to ask around for a core dev to
make this change when the Hardy+1 repos open.

-- 
grep -P is not supported
https://bugs.launchpad.net/bugs/15051
You received this bug notification because you are a member of Ubuntu
Bugs, which is a direct subscriber.

-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to