怎样同时打开多极子目录的特定文件?

Vim、Emacs配置和使用
回复
头像
adagio
论坛版主
帖子: 22110
注册时间: 2008-02-17 23:47
来自: 美丽富饶的那啥星球

怎样同时打开多极子目录的特定文件?

#1

帖子 adagio » 2008-10-04 17:10

我有CD1~CD5共五个子目录,每个下面都有一个“CDImage.cue”文件如下:

代码: 全选

ls -R
.:
CD1  CD2  CD3  CD4  CD5

./CD1:
CDImage.ape  CDImage.cue  Unknown Title.log

./CD2:
CDImage.ape  CDImage.cue  Complete Brahms Edition - Orchestral Works (CD 2 5).log

./CD3:
CDImage.ape  CDImage.cue  Complete Brahms Edition - Vol 1 (3 4).log

./CD4:
CDImage.ape  CDImage.cue  Complete Brahms Edition - Orch.log

./CD5:
21 Danses hongroises.log  CDImage.ape  CDImage.cue
请问如何同时用vi打开?
我这样输入不行,只会打开一个空文件:

代码: 全选

ls -R |grep cue |gvim
要怎么写啊?
另外怎么让它们都在同一个窗口打开,就是用标签方式打开那种?
:em03


还有就是怎么同时删除那些*.log文件?
明天就换大三八!
——8核CPU、8G内存、8T硬盘……
8卡交火,80寸大屏放8个……
IPv8的光纤要8条……

---------------------------------------------------------------------------------
[图片版]新手当自强(续)FAQ
[新手进阶]挂载、fstab、调整linux分区
[图片版]E17桌面环境配置手把手
头像
kofshower
帖子: 1343
注册时间: 2007-03-13 11:23
联系:

Re: 怎样同时打开多极子目录的特定文件?

#2

帖子 kofshower » 2008-10-05 14:35

是你命令错了的缘故gvim前面加上xargs
比如我输入ls|xargs vim
附件
2008-10-05-143633_1274x772_scrot.png
"We are all in the mud, but some of us are looking at the stars." (Oscar Wilde)
We are not born for ourselves.
人生天地间,并非为自己
Homepage:http://sites.google.com/site/polarisnotme/
头像
bones7456
帖子: 8495
注册时间: 2006-04-12 20:05
来自: 杭州
联系:

Re: 怎样同时打开多极子目录的特定文件?

#3

帖子 bones7456 » 2008-10-05 14:38

gvim */CDImage.cue
行不行?
关注我的blog: ε==3
头像
adagio
论坛版主
帖子: 22110
注册时间: 2008-02-17 23:47
来自: 美丽富饶的那啥星球

Re: 怎样同时打开多极子目录的特定文件?

#4

帖子 adagio » 2008-10-05 22:06

还是不行喔!
ls|xargs vim可以打开本层目录的所有文件
但是用“ls -R |grep cue |xargs gvim”只会打开一个名为“CDImage.cue”的空文件,不明白那里问题,不过有个出错信息:

代码: 全选

(gvim:21042): Pango-WARNING **: Error loading GSUB table 28333
啥意思啊?你们再看看

gvim */CDImage.cue也是一样,就是那个出错信息

麻烦啊,现在我只好老老实实一个个打开……
明天就换大三八!
——8核CPU、8G内存、8T硬盘……
8卡交火,80寸大屏放8个……
IPv8的光纤要8条……

---------------------------------------------------------------------------------
[图片版]新手当自强(续)FAQ
[新手进阶]挂载、fstab、调整linux分区
[图片版]E17桌面环境配置手把手
头像
kofshower
帖子: 1343
注册时间: 2007-03-13 11:23
联系:

Re: 怎样同时打开多极子目录的特定文件?

#5

帖子 kofshower » 2008-10-06 5:42

:em20 ,没仔细看,是多级的话必须用find,
find . -name "*.cue"|xargs gvim
2008-10-06-054400_796x123_scrot.png
"We are all in the mud, but some of us are looking at the stars." (Oscar Wilde)
We are not born for ourselves.
人生天地间,并非为自己
Homepage:http://sites.google.com/site/polarisnotme/
头像
eexpress
帖子: 58428
注册时间: 2005-08-14 21:55
来自: 长沙

Re: 怎样同时打开多极子目录的特定文件?

#6

帖子 eexpress » 2008-10-06 9:44

都find了。还xargs干嘛。
● 鸣学
头像
kofshower
帖子: 1343
注册时间: 2007-03-13 11:23
联系:

Re: 怎样同时打开多极子目录的特定文件?

#7

帖子 kofshower » 2008-10-06 14:28

The xargs utility is one of the most useful and the most underappreciated utilities in Unix piping toolbox. It is often used with find command as it is more flexible then build in option -exec.


Xargs constructs an argument list for an arbitrary Unix command using standard input and executes this command. xargs [options] [command]

The xargs command creates an argument list for command from standard input. It is typically used with a pipe getting its input from commands like ls and find The latter is probably the most common source of xargs input and is covered in examples below.

One of the most common xargs applications in pipes is to execute a command once for each piped record:
$ find . -name '*050106*' print | xargs -n2 grep 'From: Ralph'
cat iplist | xargs -n1 nmap -sV

加个xargs强调一下是作为参数,而不是作为内容传递的
"We are all in the mud, but some of us are looking at the stars." (Oscar Wilde)
We are not born for ourselves.
人生天地间,并非为自己
Homepage:http://sites.google.com/site/polarisnotme/
头像
adagio
论坛版主
帖子: 22110
注册时间: 2008-02-17 23:47
来自: 美丽富饶的那啥星球

Re: 怎样同时打开多极子目录的特定文件?

#8

帖子 adagio » 2008-10-06 19:24

嘻嘻,搞掂……
多谢LS好人!
这下好了,原来有十几个子目录,一个个打开累死我了。以后就轻松点了

ps:EE乱说话的,如果不加xargs,不行,还是空文件嘿嘿!
:em11
明天就换大三八!
——8核CPU、8G内存、8T硬盘……
8卡交火,80寸大屏放8个……
IPv8的光纤要8条……

---------------------------------------------------------------------------------
[图片版]新手当自强(续)FAQ
[新手进阶]挂载、fstab、调整linux分区
[图片版]E17桌面环境配置手把手
回复