replacing line in iTunes Music Library.xml via perl

Lazarus18

In debt medical student
So in brief here's the situation:
I have my Mp3s on my tower. I have iTunes on my laptop pointed to that shared network directory. I have symbolic links to itunes Music Library.xml and iTunes 4 Music Library on both my iBook and my tower. The point being that playlists and whatnot made on the iBook can be seen by the tower.

The problem is that on the tower the Library in iTunes preferences is a local directory, on the iBook it's a network directory. ITUnes can figure this out fine, it's not a problem. But TiVo can't, and the whole point of keeping the libraries in sync is so that TiVo can play my playlists.

At any rate what I need to do is create a script of some sort that can take the iTunes Music Library.xml file and replace localhost/Volumes/Music with localhost/Volumes/Maxtor 80GB/Music. The best thing I've come up with is to use perl, and do:
perl -pi -e 's/foo/bar/g'

But when I replace foo with /localhost/Volumes/Music and bar with /localhost/Volumes/Maxtor 80GB/Music I get the following error:
Bareword found where operator expected at -e line 1, near "s/localhost/Volumes/Music"
Bareword found where operator expected at -e line 1, near "2080GB"
(Missing operator before GB?)
syntax error at -e line 1, near "s/localhost/Volumes/Music"
Search pattern not terminated at -e line 1.

I don't know much of anything about perl, but it seems that my use of slashes is not sitting well with it, but I haven't had any better luck using ' ' or " " around my string. How do I tell perl that the slashes are part of the string I'm replacing?

Or if anyone has a better solution I'd love to hear that too. Thanks.
 
Ah yes, the sure fire way to answer your own question... post it so that 10 minutes later you can figure it out yourself. If anyone for whatever reason encounters the same problem (and is as ignorant as I am) simply replacing slash (/) with pipe (|) as the delimiter allows the slashes in the string to be read correctly.
 
Back
Top