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