linux - 删除输出linux中的字母

标签 linux shell output

我将以下文本作为 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/

相关文章:

linux - 将目录中的文件分配给子目录

linux - TCP_NEW_SYN_RECV 是什么意思?

macos - 如何在Mac终端搜索包含汉字的文件?

regex - 这个 BASH shell 脚本摘录有什么作用?

linux - 查找定义 Linux 函数的位置

linux - 如何在 Redhat Linux 上以非 root 用户身份安装 ReviewBoard?

linux - Biolinux 中的自动完成行为

c++ - 有没有一种方法可以更具体地用C++格式化输出?

Python:从字符串的多行中删除空格

c++ - 如何检查用户是否输入?