#!/usr/bin/perl
opendir (PU, "." || die "serious dainbramage: $!";
open(OUTPUTFILE,">list.txt" || die "Failed to open OUTPUTFILE, $!\n";
#@greplist = grep { m/^[p]// } readdir PU
while (<PU>)
{
@line = grep {CONNECT},PU;
print OUTPUTFILE "@line";
}
close OUTPUTFILE;
closedir PU;
-------------------------------------------------------
Hi, above is my "failed" scipt. i wish to write a scipt which has some function:
1) From an dir, read files which the name is p....., if the content of that p.... files has the word "CONNECT", MOVE all that files in one file. For example, C file has the files name which their content has the word "CONNECT".
2) I will call a script, xx (while (<>){
printf "%s\n", substr($_,3,20); } )
which will extract the date of the file name in C file. The output shoud be in another file, D which has the name of that file n also the date.
3) Then i will mail this D file to somebody.
i think i know how to do with num 3. The hard thing is num 1 n 2.
Pls help me, thank a lot.
opendir (PU, "." || die "serious dainbramage: $!";
open(OUTPUTFILE,">list.txt" || die "Failed to open OUTPUTFILE, $!\n";
#@greplist = grep { m/^[p]// } readdir PU
while (<PU>)
{
@line = grep {CONNECT},PU;
print OUTPUTFILE "@line";
}
close OUTPUTFILE;
closedir PU;
-------------------------------------------------------
Hi, above is my "failed" scipt. i wish to write a scipt which has some function:
1) From an dir, read files which the name is p....., if the content of that p.... files has the word "CONNECT", MOVE all that files in one file. For example, C file has the files name which their content has the word "CONNECT".
2) I will call a script, xx (while (<>){
printf "%s\n", substr($_,3,20); } )
which will extract the date of the file name in C file. The output shoud be in another file, D which has the name of that file n also the date.
3) Then i will mail this D file to somebody.
i think i know how to do with num 3. The hard thing is num 1 n 2.
Pls help me, thank a lot.