由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
Unix版 - grep usage
相关主题
shell problem: how to "grep" in this case?Re: 如何用grep查找子目录下的文件?--stop!
[转载] grep questionRe: 如何用grep查找子目录下的文件?
如何把一个目录下的文件名全部改成小写?sed? awk? or mak a program?
[转载] How to list the files with specific permission?how to grep a string in all sub-dirs?
shell programming problemshow to escape both ' and " from tcsh?
How do i get a list of all computers?where is the pre-build version of cxterm-solaris
replace a string in all files under a directory?Where's emacs' private dictionary?
How to find a file in the deep children directory?UNIX Tip: the bad and the good
相关话题的讨论汇总
话题: grep话题: string话题: bbb话题: aaa话题: files
进入Unix版参与讨论
1 (共1页)
R**a
发帖数: 51
1
how to find files that contain string "aaa" AND string "bbb"?
thanks
T********r
发帖数: 6210
2
a silly way: grep aaa file | grep bbb

【在 R**a 的大作中提到】
: how to find files that contain string "aaa" AND string "bbb"?
: thanks

R**a
发帖数: 51
3
what if one wants the output to be a list of file names, such as what you get
when using grep -l.

【在 T********r 的大作中提到】
: a silly way: grep aaa file | grep bbb
T********r
发帖数: 6210
4
sorry the previous solution is wrong. it just proves one thing:
for every complex problem there is a solution that is simple,
neat and wrong. ;-)
here's the correct one, hopefully
grep -l aaa `grep -l bbb files-to-grep`

【在 R**a 的大作中提到】
: what if one wants the output to be a list of file names, such as what you get
: when using grep -l.

1 (共1页)
进入Unix版参与讨论
相关主题
UNIX Tip: the bad and the goodshell programming problems
如何删除一组文件或给一组文件更名? How do i get a list of all computers?
regular expression中回车用什么表示?replace a string in all files under a directory?
一个高技术问题How to find a file in the deep children directory?
shell problem: how to "grep" in this case?Re: 如何用grep查找子目录下的文件?--stop!
[转载] grep questionRe: 如何用grep查找子目录下的文件?
如何把一个目录下的文件名全部改成小写?sed? awk? or mak a program?
[转载] How to list the files with specific permission?how to grep a string in all sub-dirs?
相关话题的讨论汇总
话题: grep话题: string话题: bbb话题: aaa话题: files