in reply to Sorting names using Regular Expressions and placing them in different Files.

Here you go :)
#!/usr/bin/perl -w use strict; my $prefix = '-20041202'; my @types = qw(BSC SBSCSubsystem MCBTSSubsystem); eval 'open ('.$_.',">'.$_.'") or die($!)' for @types; die $@ if $@; while(<*>) { my $t_fname = $_; next if ($t_fname eq '.' or $t_fname eq '..'); $t_fname =~ /^$_$prefix/ and eval('print ('.$_.' $t_fname.chr 10)' +) for @types; }
  • Comment on Re: Sorting names using Regular Expressions and placing them in different Files.
  • Download Code

Replies are listed 'Best First'.
A reply falls below the community's threshold of quality. You may see it by logging in.