#!/usr/bin/perl
#perl-grep.pl
my $regex = shift @ARGV;
print "Regex is [$regex]\n";
while ( <> )
{
print if m/$regex/;
}
[root@"+":/tmp]$ perl perl-grep.pl new *.pl
Regex is [new]
my $new_name = "$dirname/$basename";
rename ($old_name, $new_name)
or warn "Can't rename '$old_name' to '$new_name': $!";
[root@"+":/tmp]$
'Perl' 카테고리의 다른 글
Search the repeated pattern and Show what were matched. (0) | 2011.04.20 |
---|---|
Search repeated pattern by PERL (0) | 2011.04.20 |