You can use the following regex to get the patch
number
chomp( $ch ); # remove the newline character
my ($pnum) = substr( $ch, 5 ); #grab everything after the
pach_
Then you can say
if( $given_patchid > $pnum ) { #compare
numerically
...
}
To sort the patches you can say
@patches = <F1>; #read the entire file into an
array
chomp @patches; #remove all of the newlines
sort { substr( $a, 5 ) < substr( $b, 5 ) } @patches; #sort
the lines by the values after the pach_
I'm not sure what result you want to store in a file, but if
it is the patches then you can say
open F2, ">file.out" or die "Could not open file.out:
$!\n"; #open a file for writing
print F2 join( @patches, "\n" ); #add a newline to the end of
each line and write it to file.
|
- a simple pattern matching quesn PRADEEP GOEL
- Re: a simple pattern matching quesn Tanton Gibbs
- Re: a simple pattern matching quesn John W . Krahn
- Re: a simple pattern matching quesn Paul