On Mon, May 20, 2019 at 08:01:12PM +0200, Juan Francisco Cantero Hurtado wrote:
| I've a test in one of my ports similar to this:
| 
| $ cat test.txt
| 
$TESTTMP/hgcache/master/packs/7bcd2d90b99395ca43172a0dd24e18860b2902f9.histpack
| 
$TESTTMP/hgcache/master/packs/dc8f8fdc76690ce27791ce9f53a18da379e50d37.datapack
| $ cat test.txt | grep ".datapack\|.histpack"
| $ cat test.txt | ggrep ".datapack\|.histpack"
| 
$TESTTMP/hgcache/master/packs/7bcd2d90b99395ca43172a0dd24e18860b2902f9.histpack
| 
$TESTTMP/hgcache/master/packs/dc8f8fdc76690ce27791ce9f53a18da379e50d37.datapack
| 
| The grep command works with GNU, NetBSD, FreeBSD and BusyBox. It fails
| on OpenBSD and Solaris 11. I'm suggesting upstream to change the command
| to "grep -e ".datapack" -e ".histpack"" but I would like to know if this
| is a bug or we just don't support the | in the grep patterns.

Try grep -E, or egrep, for extended regular expression matching:

[weerd@pom] $ cat sample 
a
b
c
[weerd@pom] $ grep 'a|b' sample
[weerd@pom] $ grep -E 'a|b' sample
a
b

The standard grep(1) defaults to "basic" Regular Expressions, whereas
the branch-feature is part of Extended Regular Expressions (ERE).  See
re_format(7) for details.

Cheers,

Paul 'WEiRD' de Weerd

-- 
>++++++++[<++++++++++>-]<+++++++.>+++[<------>-]<.>+++[<+
+++++++++++>-]<.>++[<------------>-]<+.--------------.[-]
                 http://www.weirdnet.nl/                 

Reply via email to