bash命令输出以下内容:
Runtime Name: vmhba2:C0:T3:L14
Group State: active
Runtime Name: vmhba3:C0:T0:L14
Group State: active unoptimized
Runtime Name: vmhba2:C0:T1:L14
Group State: active unoptimized
Runtime Name: vmhba3:C0:T3:L14
Group State: active
Runtime Name: vmhba2:C0:T2:L14
Group State: active
我想将其传送到某种东西,使其看起来像这样:
Runtime Name: vmhba2:C0:T1:L14 Group State: active
Runtime Name: vmhba3:C0:T3:L14 Group State: active unoptimized
Runtime Name: vmhba2:C0:T2:L14 Group State: active
[...]
即删除所有其他换行符
我尝试过,... |tr "\nGroup" " "
但是它删除了所有换行符,并且还吃了其他一些字母。谢谢
tr
完全基于字符:您要求tr删除换行符以及所有'G','r','o','u'和'p'。