将tr输出重定向到sed [英] Redirect tr output to sed
本文介绍了将tr输出重定向到sed的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我需要用另一个字符串替换文件中的字符串,但是在替换之前,我需要先将新字符串小写,然后再将其传递给 sed
.
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/(我的tr输出为小写字母)/g'file.txt
我的问题是,我们如何将替换字符串作为参数传递?
My question is, How we could pass the replacement string as a parameter ?
推荐答案
sed "s/foo/$(echo .. |tr ...)/g" file.txt
这篇关于将tr输出重定向到sed的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文