itunes – All the filenames of the songs in a playlist

I wrote a shell script to get the filenames of songs having a certain text in the comment tag. But apparently the tag is encrypted or something—grep -l string file cannot find any, and omitting the -l on a known hit doesn’t find it.

I can make a playlist that has all the tracks that I want, but I guess the playlists are embedded in the library rather than being separate files.

Is there a way to get all the filenames of the tracks in a playlist? It needs to be scriptable, as the playlist will be changing as the comments change.