image
image

Go Back   macosx.com > Mac Help Forums > Unix & X11

Reply
 
Thread Tools
  #1  
Old August 7th, 2004, 04:44 PM
In debt medical student
 
Join Date: Sep 2001
Location: In a chair
Posts: 270
Thanks: 0
Thanked 0 Times in 0 Posts
Lazarus18 is on a distinguished road
replacing line in iTunes Music Library.xml via perl

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:
Quote:
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.
__________________
-Rob


-iMac 20" 2.4Ghz C2D, 1GB RAM, 500GB HD
-iBook G4 1.2 GHz, 756 MB RAM, 60GB HD, Superdrive
Reply With Quote
  #2  
Old August 7th, 2004, 05:02 PM
In debt medical student
 
Join Date: Sep 2001
Location: In a chair
Posts: 270
Thanks: 0
Thanked 0 Times in 0 Posts
Lazarus18 is on a distinguished road
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.
__________________
-Rob


-iMac 20" 2.4Ghz C2D, 1GB RAM, 500GB HD
-iBook G4 1.2 GHz, 756 MB RAM, 60GB HD, Superdrive

Last edited by Lazarus18; August 7th, 2004 at 05:10 PM. Reason: clarity
Reply With Quote
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off
Forum Jump


All times are GMT -5. The time now is 10:10 PM.


Mac Support® Version 3.7.2
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.1.0
Copyright 2000-2008 DigitalCrowd, Inc.