in reply to Perl Scripting for testing
This is a case for a perl regular expression. It should look something like this,
qr is a quoting operator which lets you precompile a regex for later use.my $re = qr/^[A-Z][^_]*_[A-Z][^_]*_[a-z][^.]*\.html$/; open my $fh, '>', 'badnames.txt' or die $!; while (<DATA>) { print $fh $_ unless m/$re/; } close $fh or die $!; __DATA__ Kilo_Kili_asc.html kilo_Kili_asc.html Jiko_Huji_asc.html Jiko_Huji_asc.htm Puji_huki_asc.html Puji_Huki_Asc.html
After Compline,
Zaxo
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Perl Scripting for testing
by g0n (Priest) on Mar 31, 2005 at 08:58 UTC | |
by polettix (Vicar) on Mar 31, 2005 at 09:55 UTC |