in reply to Re: REGEX on multiple lines
in thread REGEX on multiple lines
#!/usr/local/bin/perl -w use strict; use warnings; print "Enter the output file you would like to analyze: "; chomp (my $filename = <STDIN>); print "Enter the isotope you want to extract (ex: Am-241): "; chomp (my $iso= <STDIN>); open(IN, "<", $filename) or die("Can't read the source:$!"); open(OUT, ">Comp_$filename"); select (OUT); $/ = '0AVERAGE COMPOSITION IN PINS.'; while (<IN>) { next if ! /$iso/; chomp; print "$/$_"; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: REGEX on multiple lines
by GrandFather (Saint) on Jan 31, 2007 at 19:39 UTC |