Text 通过对齐给定的分隔符将文本制成表格
我的问题很简单,特别是对于那些熟悉Vim列表插件的人来说。我想将从shell中的另一个命令获得的输出制成表格。例如,给定生成给定输出的以下命令:Text 通过对齐给定的分隔符将文本制成表格,text,output,tabular,Text,Output,Tabular,我的问题很简单,特别是对于那些熟悉Vim列表插件的人来说。我想将从shell中的另一个命令获得的输出制成表格。例如,给定生成给定输出的以下命令: $ mpc playlist Metallica - Ride the lightning - The call of Ktulu Metallica - Master of puppets - Master of puppets Metallica - Master of puppets - Orion (Instrumental) Nirvana
$ mpc playlist
Metallica - Ride the lightning - The call of Ktulu
Metallica - Master of puppets - Master of puppets
Metallica - Master of puppets - Orion (Instrumental)
Nirvana - Nevermind - Smells like teen spirit
Metallica - ...And justice for all - One
Metallica - ...And justice for all - ...And justice for all
Metallica - Kill'em all - Seek and destroy
Metallica - Metallica - Wherever I may roam
Metallica - Metallica - The god that failed
我需要的是一个命令,我可以通过管道将此输出传输到该命令,并获得以下内容
$ mpc playlist | tabularize --delimiter=" - "
Metallica - Ride the lightning - The call of Ktulu
Metallica - Master of puppets - Master of puppets
Metallica - Master of puppets - Orion (Instrumental)
Nirvana - Nevermind - Smells like teen spirit
Metallica - ...And justice for all - One
Metallica - ...And justice for all - ...And justice for all
Metallica - Kill'em all - Seek and destroy
Metallica - Metallica - Wherever I may roam
Metallica - Metallica - The god that failed
有什么想法吗?您要查找的命令是
列
尝试mpc播放列表| column-t-s'-'-o'
遗憾的是,如果输入中有
'-'
字符,并且指定'-'
也将按空格(而不是整个字符串)列化,这将不起作用。**匹配任何符号中的一个或多个:'.*'(贪婪到第二个连字符)**所需模式的开始:'\zs'(Vim语法)
**要匹配的模式:'-'
:%Tab /.*\zs -/