Thanks Chubler XL, ygemici.
I've carefully copied and pasted your codes, they do not return any result.
I'm using the debian version of awk (mawk), does that affect your suggestions?
Thank you for trying. I'm going to give it one last attempt to try and combine your suggestions into one.
1. The best way to avoid metacharacters is to use the 'index' function
2. The best way to approach comparing 2 files is to use an 'array'
With that in mind, to simplify, i've made all files tab seperated and removed the .mp3 .
Use 2 arrays from file1 "Playlist"...
- a for <field1> "Artist"
- t for <field2> "Title"
Example Line from Playlist;
- Shaggy Angel (Bonus Track)
Then;
1. compare the indexed Title "Angel (Bonus Track)" to file2 "Master-Music-List" <field2> "Title"
2. check that the indexed Artist "Shaggy" matches "Master-Music-List" <field1> "Artist"
If 'both' array1 (title) , and array2 (artist) match, then print the result.
Example;
Match this from "Playlist" to "Master-Music-List";
- Shaggy Angel (Bonus Track)
Master-Music-List Lines:
- Shaggy Angel (Bonus Track) 32000 /Music/S/Shaggy/Angel (Bonus Track.mp3
- The Rolling Stones Angel 128000 /Music/R/Rolling Stones/Angel.mp3
This way, the song 'Angel (Bonus Track)' will match for Shaggy and not for Rolling Stones.
Could someone please help to include the arrays and index functions ?
Thank you.