** Description changed:

  $ printf 'a
  b\0b' | grep --null-data "a
  b" |  hexdump -C
  00000000  61 0a 62 00 62 00                                 |a.b.b.|
  00000006
  
  expect
  00000000  61 0a 62
+ 
+ EDIT:
+ 
+ Apparently, in the above the pattern string is considered as two
+ patterns 'a' and 'b'.
+ 
+ With -P you get
+ 
+ $ printf 'a\nb\0b' | grep -zP 'a
+ b' | hexdump -C
+ grep: the -P option only supports a single pattern
+ 
+ However, if the newline is coded as '\n' in the pattern, it works, but
+ only with -P
+ 
+ $ printf 'a\nb\0b' | grep -zP 'a\nb' | hexdump -C
+ 00000000  61 0a 62 00                                       |a.b.|
+ 00000004
+ $ printf 'a\nb\0b' | grep -z 'a\nb' | hexdump -C
+ $ printf 'a\nb\0b' | grep -zE 'a\nb' | hexdump -C
+ $ printf 'a\nb\0b' | grep -zF 'a\nb' | hexdump -C
+ 
+ I expect it should work by other matcher selectors than -P, too.
  
  ProblemType: Bug
  DistroRelease: Ubuntu 16.04
  Package: grep 2.25-1~16.04.1
  ProcVersionSignature: Ubuntu 4.4.0-45.66-generic 4.4.21
  Uname: Linux 4.4.0-45-generic x86_64
  NonfreeKernelModules: nvidia_uvm nvidia
  ApportVersion: 2.20.1-0ubuntu2.1
  Architecture: amd64
  CurrentDesktop: XFCE
  Date: Fri Nov 11 12:58:27 2016
  EcryptfsInUse: Yes
  InstallationDate: Installed on 2015-11-21 (355 days ago)
  InstallationMedia: Xubuntu 15.10 "Wily Werewolf" - Release amd64 (20151021)
  SourcePackage: grep
  UpgradeStatus: Upgraded to xenial on 2016-06-24 (139 days ago)

** Summary changed:

- Does not support patterns containing newline
+ Does not support patterns containing escaped newline character, except with -P

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/1641092

Title:
  Does not support patterns containing escaped newline character, except
  with -P

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/grep/+bug/1641092/+subscriptions

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

Reply via email to