Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/image/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Text 通过对齐给定的分隔符将文本制成表格_Text_Output_Tabular - Fatal编程技术网

Text 通过对齐给定的分隔符将文本制成表格

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

我的问题很简单,特别是对于那些熟悉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 - 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 -/