Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

BabaG

macrumors member
Original poster
Jan 5, 2007
83
0
could someone straighten out this line?

find /Users/babag/Documents/m3u/for_sed_tests -name "*.m3u" | xargs perl -pi -e 's/home\/babag\/mnt\/SAMBA/\/Volumes\/g'

not a programmer, here, but have done some scripting in linux and
windows.

i have a lot of text files, m3u files to be specific, that i'd like to alter
a path line in. the original path is:

/home/babag/mnt/SAMBA/homeserver/Data-1_max80/CDs/FLAC

i'd like to change it to read:

/Volumes/homeserver/Data-1_max80/CDs/FLAC

when i used the line above, it produces this error:

Substitution replacement not terminated at -e line 1.

how do i get the line to work and alter all my files as described?

thanks,
BabaG
 
I don't know if that, in perl, will replace text in a file like sed.

However, there is an issue with your substitution command:
s/home\/babag\/mnt\/SAMBA/\/Volumes\/g

broken down, we have:
s/
home\/babag\/mnt\/SAMBA
/
\/Volumes\/g

I think to get the replacement command you want, the last / should not be escaped with \. So instead, you would have:
s/home\/babag\/mnt\/SAMBA/\/Volumes/g

-Lee
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.