Hi,

I am writing a script to get a list of users and their profile paths, from Active Directory. However, I am having problems with the shell removing the backslashes from the paths, i.e.

Username serverusernameprofilefolder

where it should be

Username \\server\username\profilefolder

So far this is what I have handling this data... test is the file containing a dump of all AD users and their profile paths, and match is a file containing just usernames that I wish to extract from the test file.

cat test | while read a b
do
username=`echo "$a"`
if grep -i $username match > /dev/null
then
echo $a ' ' $b | sed -e 's/^\\/\\\\/g'
fi
done


The line sed -e 's/^\\/\\\\/g' gives me the two \'s at the beginning so I end up with...

Username \\serverusernameprofilefolder

But I can't find a way of retaining them all. I can't put $b in single quotes as it just echo's $b a lot.

Any help/advice would be greatly appreciated!

Many thanks.