Reputation: 3
I am trying to write a script that pulls in an e-mail address from a file, and then does an ldapsearch query for the mail attribute. I am having problems, and I think the "@" sign in the email address is the culprit
while IFS=, read uid user mail
do
filter='(mail='"$mail"')'
echo $filter
done < input.csv
I keep getting output like this:
)[email protected]
When I want it to look like this:
([email protected])
I appreciate any help!
Thanks
Upvotes: 0
Views: 752
Reputation: 241861
The culprit is the carriage return (\r
or \x0d
) at the end of each line of your input.
You need to convert your csv file to unix-style line endings, or otherwise remove the trailing carriage return.
Use hd
to see the output in hex, which might make what's going on more obvious (the )
is being written on top of the (
)
Upvotes: 4