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*
|