bashgrepeyed3

grep on word with colon fails from command output


Can anyone explain why grepping for "artist" returns results, but grepping for "artist:" returns nothing?

FIRST RESULT:

MacBook-Pro:~ kjesso$ eyed3 ./Music/Deftones/2006\ -\ Saturday\ Night\ Wrist/Deftones\ -\ 02\ -\ Rapture.mp3
Deftones - 02 - Rapture.mp3 [ 5.26 MB ]
-------------------------------------------------------------------------------
Time: 03:25 MPEG1, Layer III    [ ~213 kb/s @ 44100 Hz - Joint stereo ]
-------------------------------------------------------------------------------
ID3 v2.3:
title: Rapture
artist: Deftones
album: Saturday Night Wrist
album artist: None
recording date: 2006
track: 2        genre: Rock (id 17)
Publisher/label: Maverick

SECOND RESULT:

MacBook-Pro:~ kjesso$ eyed3 ./Music/Deftones/2006\ -\ Saturday\ Night\ Wrist/Deftones\ -\ 02\ -\ Rapture.mp3 | grep "artist"
artist: Deftones
album artist: None

THIRD RESULT:

MacBook-Pro:~ kjesso$ eyed3 ./Music/Deftones/2006\ -\ Saturday\ Night\ Wrist/Deftones\ -\ 02\ -\ Rapture.mp3 | grep "artist:"

Solution

  • eyed3 adds some terminal markup for color-coding, so there are a bunch of bytes in the output that aren't visible on your terminal but which the terminal used to determine the color-coding — even if that color-coding is "exactly the same color throughout.

    Adding the --no-color option would work perfectly:

    $ eyed3 --no-color ./Music/Deftones/2006\ -\ Saturday\ Night\ Wrist/Deftones\ -\ 02\ -\ Rapture.mp3 | grep "artist:"