I have some text with a password which may contain special characters (like /, *, ., [], () and other that may be used in regular expressions). How to remove that password from the text using Korn shell or maybe sed or awk? I need an answer which would be compatible with Linux and IBM AIX.
For example, the password is "123*(/abc" (it is contained in a variable). The text (it is also contained in a variable) may look like below: "connect user/123*(/abc@connection_string"
As a result I want to obtain following text: "connect user/@connection_string"
I tried to use tr -d
but received wrong result:
l_pwd='1234/\@1234'
l_txt='connect target user/1234/\@1234@connection'
print $l_txt | tr -d $l_pwd
connect target user\connection