由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
Unix版 - how to search a pattern in all files
相关主题
replace a string in all files under a directory?一个初级的shell scripting问题
how to grep with more than one patterns in tcsh?ask a stupid question about DOS
my script Re: how would you do this?what is the command option for this?
Help!如何把一个目录下的文件名全部改成小写?
什么东东能将目录及其子目录下的.tar文件展开![转载] How to list the files with specific permission?
unix commands questionshell programming problems
Who knows this shell varialbe? How do i get a list of all computers?
有没有cp或ftp所有文件和子目录里的文件的命令?How to find a file in the deep children directory?
相关话题的讨论汇总
话题: files话题: pattern话题: opendir话题: search话题: grep
进入Unix版参与讨论
1 (共1页)
k******d
发帖数: 8
1
recursively under a specific directory?
I write a perl, to recursive read files under all subdirectories, but failed
with error msg: "Bad symbol for filehandle" for the lime of code below:
if (!opendir($dirvar, $dirname)){
...............
so I'm thinking of "sac" or sth?
help!
t*u
发帖数: 186
2
try this cammand:
find [YourSpecificDirectory] -exec grep [YourPattern] {} \;

【在 k******d 的大作中提到】
: recursively under a specific directory?
: I write a perl, to recursive read files under all subdirectories, but failed
: with error msg: "Bad symbol for filehandle" for the lime of code below:
: if (!opendir($dirvar, $dirname)){
: ...............
: so I'm thinking of "sac" or sth?
: help!

w**n
发帖数: 88
3
Your syntax for opendir is wrong ...
perldoc -f opendir

【在 k******d 的大作中提到】
: recursively under a specific directory?
: I write a perl, to recursive read files under all subdirectories, but failed
: with error msg: "Bad symbol for filehandle" for the lime of code below:
: if (!opendir($dirvar, $dirname)){
: ...............
: so I'm thinking of "sac" or sth?
: help!

m***z
发帖数: 1
4

Shell script:
% grep "your_pattern" * -R
Similarly in perl:
system ('grep', 'your_pattern', '.' ,'-R')
should work.

【在 k******d 的大作中提到】
: recursively under a specific directory?
: I write a perl, to recursive read files under all subdirectories, but failed
: with error msg: "Bad symbol for filehandle" for the lime of code below:
: if (!opendir($dirvar, $dirname)){
: ...............
: so I'm thinking of "sac" or sth?
: help!

a****a
发帖数: 98
5
grep -r
otherwise, update your grep

【在 k******d 的大作中提到】
: recursively under a specific directory?
: I write a perl, to recursive read files under all subdirectories, but failed
: with error msg: "Bad symbol for filehandle" for the lime of code below:
: if (!opendir($dirvar, $dirname)){
: ...............
: so I'm thinking of "sac" or sth?
: help!

1 (共1页)
进入Unix版参与讨论
相关主题
How to find a file in the deep children directory?什么东东能将目录及其子目录下的.tar文件展开!
Re: 如何用grep查找子目录下的文件?--stop!unix commands question
Re: 如何用grep查找子目录下的文件?Who knows this shell varialbe?
sed? awk? or mak a program?有没有cp或ftp所有文件和子目录里的文件的命令?
replace a string in all files under a directory?一个初级的shell scripting问题
how to grep with more than one patterns in tcsh?ask a stupid question about DOS
my script Re: how would you do this?what is the command option for this?
Help!如何把一个目录下的文件名全部改成小写?
相关话题的讨论汇总
话题: files话题: pattern话题: opendir话题: search话题: grep