The metagrep script will recursively walk a directory containing FLAC files, and find tracks with metadata matching a pattern.
- This script is tested on Ubuntu 8.10; mileage may vary on other platforms.
- This script is licensed under the GPL 2.0 or later.
Usage: metagrep [options] pattern [flac_dir]
Option Description Default --help Display this help message. --[no]insensitive Case-insensitive pattern matching. noinsensitive --[no]invert Show tracks that do not have matching pattern. noinvert --[no]listonly Only display name of matching files. nolistonly --metaflac=program Program to call to read metadata in FLAC file. metaflac --quiet Quiet operation, no screen output. --tmp=directory Directory to store temporary files in. /tmp --verbose Verbose output of progress information.
The pattern you provide is a standard Perl regular expression. Metadata tags are represented in FLAC files as name=value pairs. The entire tag is matched against the pattern.
Search for tracks where track number is 1:
- metagrep ^TRACKNUMBER=1$
Search for tracks with the word "love" in the track title (case insensitive):
- metagrep --insensitive ^TITLE=.*love
List tracks with the title "Rhapsody in Blue":
- metagrep --listonly "^TITLE=Rhapsody in Blue$"
Search for tracks with a MusicBrainz track identifier:
- metagrep ^MUSICBRAINZ_TRACKID=
Search for tracks with a MusicIP PUID:
- metagrep ^MUSICIP_PUID=
Search for tracks missing a MusicIP PUID:
- metagrep --invert ^MUSICIP_PUID=
You can store persistent command-line options in a file called .metagrep in your home directory. They will be read as defaults prior to processing any passed command-line options.
- Initial version released to MusicBrainz.