5

有没有一个命令可以把如下输出转成表格形式的?

 3 years ago
source link: https://www.v2ex.com/t/847352
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

V2EX  ›  程序员

有没有一个命令可以把如下输出转成表格形式的?

  kyrre · 5 分钟前 · 20 次点击
# ethtool -i <网卡名>
driver: tun
version: 1.6
firmware-version:
expansion-rom-version:
bus-info: tap
supports-statistics: no
supports-test: no
supports-eeprom-access: no
supports-register-dump: no
supports-priv-flags: no

我想要的功能如下:

# ethtool -i <网卡名> |nbcmd
driver | version | firmware-version | ...
tun    | 1.6     |                  | ...

看了一下 column 命令太傻了,好像不支持这种行内解析。

当然,如果类似 xargs 这种方式就更好了

awesome_cmd ethtool -i <网卡名>
input 1  | driver | version | firmware-version | ...
网卡名    | tun     | 1.6     |                  | ...

Recommend

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK