While loops and awk

I am trying to make a script that will replace backslashes in a file, but only if the occurance is a pathname. In the file, there are a lot of regular expressions as well, so I'm trying to preserve the integrity of those regular expressions, but convert Windows relative paths. I'm using bash and this is what I've tried:

line="~/path/to/something~ ~\path\to\something~"
loop=2
while [ ! "`echo \"$oldline\" | grep '\\\'`" ]; do # see note...
oldline="`echo \"$line\" | tr -d '\r' | awk -F \~ '{print $loop}'`"
let loop=$loop+2
done

Note: I'm using Mac OS X and apparently Darwin doesn't like a simple escaped backslash. I have to escape the escaping backslash to get it to work. Just don't try to match multiple backslashes, 'cause then it's even more crazy. Just a side note...

I've tried these variants of the $loop variable in the awk statement:
awk -F \~ '{print $loop}'
awk -F \~ '{print $$loop}'
awk -F \~ '{print \$$loop}'
awk -F \~ '{print $\$loop}'
awk -F \~ '{print $"$loop"}'

Of course, they all lead to the same error - illegal field $loop. Can anyone help me with an alternate way of doing this?

After a little bit of fiddling around, I figured out a solution:

awk -F \~ '{print $'$loop'}'