由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
Unix版 - 如何删除一组文件或给一组文件更名?
相关主题
how to get part of a big text file?my script Re: how would you do this?
how to find "exact" word in a file.如何在当前目录下查找替换一个串?
一个Shell问题group permission
a question about "find"?怎样用mail把某一文本文件发送给一个email地址?
太多文件不能用 ls * OR mv * ?what is the problem? what can I do?
如何只列出文件如何把一个目录下的文件名全部改成小写?
向高人请教:怎么从大量的文件中grephow to contral tar-ed file size?
[转载] How to list the files with specific permission?HELP.
相关话题的讨论汇总
话题: mystr话题: ls话题: find话题: grep话题: rm
进入Unix版参与讨论
1 (共1页)
F***Q
发帖数: 6599
1
比如find的结果中把一些文件删除,比如所有的a.out
还有用统配符好像mv不让:(
m*****e
发帖数: 4193
2
Open your eyes and look around in this board.

【在 F***Q 的大作中提到】
: 比如find的结果中把一些文件删除,比如所有的a.out
: 还有用统配符好像mv不让:(

F***Q
发帖数: 6599
3
while, I have asked the question at 6757,but nobody seems
wonna hand

【在 m*****e 的大作中提到】
: Open your eyes and look around in this board.
c*****t
发帖数: 1879
4
Give you a hint. read man page of find.

【在 F***Q 的大作中提到】
: while, I have asked the question at 6757,but nobody seems
: wonna hand

F***Q
发帖数: 6599
5
I got it,thx
but I still wonder how can I get the purpose by using ls as
ls -1 | grep mystr
which can list all of the files, then, how to delete them?
only can find exec another command?

【在 c*****t 的大作中提到】
: Give you a hint. read man page of find.
c*****t
发帖数: 1879
6
1. find could do the job as well :) Mastering find is invaluable.
2. Learn to use backquote.
rm `ls -1 | grep mystr`

【在 F***Q 的大作中提到】
: I got it,thx
: but I still wonder how can I get the purpose by using ls as
: ls -1 | grep mystr
: which can list all of the files, then, how to delete them?
: only can find exec another command?

t*********l
发帖数: 30
7
I think this won't work. should be
rm `ls -1 | xargs grep -l mystr`
c*****t
发帖数: 1879
8
Mine lists filenames containing mystr.
Yours lists files in which the contents contain mystr.
Actually, ls -1 is completely unnecessary since * is
all one needs.

【在 t*********l 的大作中提到】
: I think this won't work. should be
: rm `ls -1 | xargs grep -l mystr`

m*****e
发帖数: 4193
9

You don't want to do that. Try to think simple:
rm -f *mystr*

【在 F***Q 的大作中提到】
: I got it,thx
: but I still wonder how can I get the purpose by using ls as
: ls -1 | grep mystr
: which can list all of the files, then, how to delete them?
: only can find exec another command?

F***Q
发帖数: 6599
10
thanks all!:)

【在 m*****e 的大作中提到】
:
: You don't want to do that. Try to think simple:
: rm -f *mystr*

1 (共1页)
进入Unix版参与讨论
相关主题
HELP.太多文件不能用 ls * OR mv * ?
shell programming problems如何只列出文件
How do i get a list of all computers?向高人请教:怎么从大量的文件中grep
replace a string in all files under a directory?[转载] How to list the files with specific permission?
how to get part of a big text file?my script Re: how would you do this?
how to find "exact" word in a file.如何在当前目录下查找替换一个串?
一个Shell问题group permission
a question about "find"?怎样用mail把某一文本文件发送给一个email地址?
相关话题的讨论汇总
话题: mystr话题: ls话题: find话题: grep话题: rm