Hi,
I'm having trouble with the following search and replace script:
#!/bin/bash
# two parameters are passed in, a mapping file and the text file to replace
in
for fields in $(cat ./Mapping/$1-Mapping |awk 'BEGIN{FS=","}{print $2}')
do
searchstring= $fields
replacestring="`grep -w $fields ./Mapping/$1-Mapping |awk
'BEGIN{FS=","}{print $1}'`"
sed -e "s/$searchstring, / $replacestring, /g" $2 >TestResult
done
it fails if there is a $ sign in the variable $field e.g. amount_$ . How
can I get grep to "behave" the way I want?
Any help would be appreciated.
Regards, Mehmet
--
SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/
Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html