0
我有这样一个变量:(在新行中的每个字)在bash变量删除所有文字occurence
> echo $LIST
toto
toto2
titi
rererer
dfs
sdfsdf
titi
titi
我尝试删除的“蒂蒂”所有出现,以获得:
> echo $LIST
toto
toto2
rererer
dfs
sdfsdf
我试图与LIST = $(回声$ {// LIST蒂蒂/})并除去它,但它也删除新行,并得到这样的结果:
> echo $LIST
toto toto2 rererer dfs sdfsdf
我的问题是如何删除所有出现保持每个单词在一行吗? 感谢提前:)
子shell和回声是多余的 – 123
你可以尝试:echo“$ list”| grep -v titi –