GNU bug report logs - #39368
Possible visualization bug in GNU grep 3.1 (Ubuntu 18.04 x86_64)

Previous Next

Package: grep;

Reported by: Andrea Ranieri <andrea.ranieri <at> cnr.it>

Date: Fri, 31 Jan 2020 12:47:02 UTC

Severity: normal

Done: Paul Eggert <eggert <at> cs.ucla.edu>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: "Paul Jackson" <pj <at> usa.net>
To: 39368 <at> debbugs.gnu.org
Subject: bug#39368: Possible visualization bug in GNU grep 3.1 (Ubuntu 18.04 x86_64)
Date: Fri, 31 Jan 2020 07:54:03 -0600
You wrote:

==========
#> grep -v "Position\|hand type\|^\t\t$" ArticulationsOrder.txt | grep
'[^A-Z]' # outputs just endlines
==========

When I downloaded your attached file, and converted the above
command to the following single, non-wrapped line (as I presume
you intended):

grep -v "Position\|hand type\|^\t\t$" ArticulationsOrder.txt | grep '[^A-Z]'

then I do NOT get just endlines. 

Rather I get the same useful output that you reported getting when
piping this output through "more".

_However_, in either case, each output line ends in a carriage
return '\r', which I suspect is the key to the problem you report.

Try the following:

    echo 'abc\r' 
    echo 'xyz\r' | more

When I do that, I see both the "abc" and the "xyz"

I'm guessing you'll see just a blank line and the "xyz".

Then, for your ArticulationsOrder.txt data, try the following command,
which may (I'm guessing wildly) work better for your purposes:

grep -E -v 'hand type|Position' ArticulationsOrder.txt | tr -d '\r' 

That second grep, the "grep '[^A-Z]'", does nothing that I can see,
on your data, since every line has at least one character that is
not an [A-Z] upper case letter, so every line matches that pattern.

I would suggest that using "grep -E" (or "egrep") is clearer
than using "grep" and escaping the '|' symbols.

-- 
                Paul Jackson
                pj <at> usa.net




This bug report was last modified 5 years and 109 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.