in reply to insert lines based on some pattern
This uses a hash. You can print the output to a file.my %hash; for (@filenames) { chomp; push @{$hash{$3}}, $_ if ($_ =~ /(.+)\/(.+)\/(.+)\/.+/); } for (keys %hash) { print "#".uc($_)."\n" ; print $_."\n" for (@{$hash{$_}}); print "#END ".uc($_)."\n" ; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: insert lines based on some pattern
by CountZero (Bishop) on Feb 16, 2007 at 10:12 UTC |