Something like:
use strict; use warnings; my $file = <<FILE; ---------------------------- ! Optimized Parameters ! ! (Angstroms and Degrees) ! ---------------------- ------------------- +----------------------------------------------------- ! Name Value Derivative information (Atomic Units) + ! --------------------------------------------------------------------- +--- ! hc2 1.1136 -DE/DX = 0.0 + ! ! nc3 1.3392 -DE/DX = 0.0 + ! ! nch3 117.4979 -DE/DX = 0.0 + ! ! hn4 0.9929 -DE/DX = 0.0 + ! ---------------------------------------------------------------------- +-- GradGradGradGradGradGradGradGradGradGradGradGradGradGradGradGradGradGr +adGrad FILE open my $inFile, '<', \$file; my $valueStart; my $valueLength; my $min = 1.0; my $max = 2.0; while (<$inFile>) { next unless m/Optimized Parameters/ .. m/GradGradGrad/; next unless $valueLength or /^(.*?Name)(\s*Value)/; if (! $valueLength) { $valueStart = length $1; $valueLength = length $2; next; } my $value = substr $_, $valueStart, $valueLength; next unless $value =~ /^\s*[+-]?\d+(\.\d*)?\s*$/; next if $value < $min or $value > $max; print $_; } close $inFile;
Prints:
! hc2 1.1136 -DE/DX = 0.0 + ! ! nc3 1.3392 -DE/DX = 0.0 + !
In reply to Re: Parsing Guassian '03 Log Files
by GrandFather
in thread Parsing Guassian '03 Log Files
by Andrew_Levenson
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |