I'm using ksh to search through a log file and remove any passwords that might have been logged there. The password may contain special characters so wanted to use perl & /Q /E to to treat the string just as normal character. The perl command works on the command line
perl -pe 's/\Q123.adc*{eft{\ther/xxx/g' dirty.txt > clean.txt
but when I put it in the ksh using variables it's not removing the passwords.
#!/bin/ksh
#set -x
#### File Definitions
export LOG_FILE=dirty.txt
export LOG_FILE2=clean.txt
export STR=123.adc*{eft{\ther
echo $STR
export NEW_STR=xxx
perl -pe 's/\Q$ENV{STR}/$ENV{NEW_STR}/g' $LOG_FILE > $LOG_FILE2