惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

V
Visual Studio Blog
I
InfoQ
H
Help Net Security
GbyAI
GbyAI
博客园 - 叶小钗
Recent Announcements
Recent Announcements
Engineering at Meta
Engineering at Meta
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
爱范儿
爱范儿
Y
Y Combinator Blog
L
LangChain Blog
腾讯CDC
酷 壳 – CoolShell
酷 壳 – CoolShell
WordPress大学
WordPress大学
Stack Overflow Blog
Stack Overflow Blog
F
Fortinet All Blogs
G
Google Developers Blog
Apple Machine Learning Research
Apple Machine Learning Research
The GitHub Blog
The GitHub Blog
T
The Blog of Author Tim Ferriss
博客园 - Franky
D
Docker
Jina AI
Jina AI
罗磊的独立博客

博客园 - zhumao-2

perl将json转换成xml cnblogs终于把以前内容的管理权还给我了~ 曙光服务器千兆光纤网卡安装 关于DBI->connect ($dsn, $db_user, $db_pass, { RaiseError =>1, PrintError => 0}) - zhumao-2 RichCopy 3.5 过期?自己想办法~ 将linux密码存储到OpenLDAP里面=OpenLDAP Everywhere Revisited C语言操作OpenLDAP Perl操作OpenLDAP(未测试) 心得共享:Oracle经验技巧集锦 [From CU] 使用Perl生成usmarc记录 牛郎织女 Perl中的trim函数 在 Perl 中使用内联 perl中的特殊内置变量(转) 从网页中提取链接(转载) 打开.bz2文件 Windows 能干而 Linux 干不了的事情,那就是不需要干的事情 Linux下用Perl产生新的EXCEL文档 RPM包强制删除
在指定文件夹中的文件中查找包含指定字符的行(这个小东西不错...
zhumao-2 · 2005-08-09 · via 博客园 - zhumao-2

#!/usr/bin/perl -w
printf"write the path you want to search files:";
$searchdir=<STDIN
>;
chomp $searchdir
;
printf "Input search string:"
;
$searchstr=<STDIN
>;
chomp $searchstr
;
opendir(DIRHANDLE,$searchdir) || die "Cann't open $searchdir !"
;
while(
$file=readdir DIRHANDLE
) {
        if (-
d "$searchdir/$file"
) {
                
printf "$searchdir/$file is a directory!\n"
;
        } else {
                
open(FileHandle, "$searchdir/$file") || die "cann't open $searchdir/$file !\n"
;
                
$lines=1
;
                while (
defined($line=<FileHandle
>)) {
                        
$back=index($line,$searchstr
);
                        if (
$back != -1
) {
                                print
"$file:$lines:$line"
;
                        }
                
$lines=$lines+1
;
                }
        }
        
close(FileHandle
);
}
closedir(DIRHANDLE
);