I will get an input file which may contain a lot of bad words. I want to replace every occurrence of bad word with "beep"
Here is my input file:
in.txt
May I have your attention, please?
Bad words file:
badwords.txt
Contains bad words
My bash script to do what I intent to do:
process.sh
for badWord in ${badWords[@]}; do
outtext={outtext/badWord/beep}
done
The output:
$ ./process.sh
May I have your attention, please?
=====================================================
May I havbeep yobbeepbeeppbeep attbeepntion, plbeepabeepbeep?
Why this is not replacing bad words correctly?