I need to replace a string in a file with another string, but before the replacement I need to lowercase the new string before passing it to sed
.
echo 'NEWSTRING' | tr '[:upper:]' '[:lower:]' | sed 's/foo/(my tr output in lowercase)/g' file.txt
My question is, How we could pass the replacement string as a parameter ?