我将以下文本作为 linux 中的输出:
service {'name': 'services'}
enable yes
frequency 7200
service {'name': 'files'}
enable yes
frequency 6000
none
我正在寻找将输出转换为如下内容的方法:
services yes 7200
files yes 6000
我正在使用下一个命令:
| xargs -n 7 | awk '{print $3 " / " $5" / " $7}'
但是作为输出我有:
services} / yes / 7200
files} / yes / 6000
无论如何要删除那个},或者得到没有这个字符的最后输出?
最佳答案
如果您可以删除所有 '}',最简单的方法是使用翻译:
| xargs -n 7 | awk '{print $3 " / " $5" / " $7}'| tr -d '{'
tr -d 将删除 '{' 的每个实例
关于linux - 删除输出linux中的字母,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20549907/