I need to replace string SALT
in a file with content of another file. Problem is that the input file has multilines. I tried something like this in my bash script:
SALT=`cat salt.txt`;
sed "s/SALT/$SALT/" wp-config.php > result.txt
It work's fine when the salt.txt is single line, but if there are more lines it fails. I've read that it could do PERL. But I don't know how. Could you help me?
Another perl
way:
perl -pe 's/SALT/`cat salt.txt`/e' wp-config.php > result.txt
The key here is the /e
regexp option allowing us to use a perl
command result as a substitution string.
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments