sed guru required for help with Win32 environment variables
Hi, I posed this question last week, but in the wrong catagory - which is probably why it went unsolved/stale.
(http://www.linuxquestions.org/questi...iables-753788/) In short, my question pertains to using sed w/ Windows environment variables (ie. %CD%) on a Windows machine. Sed is not parsing the backslashes correctly in my environment variable. I am trying to build a (web) playlist. I can easily dump filenames to file in this format: Code:
D:\shares\Music\Mixtape (Various Artists)\01 Chick Habit.mp3 Code:
http://25.25.255.255/01 Chick Habit.mp3 Code:
@echo off To clarify, this works: Code:
sed -e "s,D:\\shares\\Music,http://%web_path%,g" tmp >tmp2 Code:
sed -e "s,%CD2%,http://%web_path%,g" tmp >tmp2 Code:
C:\>echo %CD2% |
i am not going to ask you to stop using sed, but since I can see distinct delimiter characters i can use, you can switch to use gawk.
Code:
C:\mp3\> echo D:\shares\Music\Mixtape (Various Artists)\01 Chick Habit.mp3 | gawk -F"\\" "{print \"http://1.1.1.1/\"$NF}" |
Quote:
Quote:
Try: Code:
sed -e "s,\,\\\\\\,g" <<< "%CD2" Code:
D:\\\\\shares\\\\\Music |
All times are GMT -5. The time now is 09:06 AM. |