Harmonic frequencies (cm**-1), IR intensities (KM/Mole), Raman scattering activities (A**4/AMU), depolarization ratios for plane and unpolarized incident light, reduced masses (AMU), force constants (mDyne/A), and normal coordinates: 1 2 3 A A A atom -- 23.5214 40.9023 56.7856 Red. masses -- 6.7793 1.0546 5.5674 Frc consts -- 0.0022 0.0010 0.0106 IR Inten -- 2.4504 0.2236 0.6152 #### #!/usr/bin/env perl use strict; use warnings; use File::Path qw/make_path/; use Cwd; my $dir = cwd(); opendir (my $dh, $dir) or die "Unable to open current directory! $!\n"; my @subdirs = grep { /^\.\.?\z/ } readdir($dh) or die "Unable to read directory! $!\n"; closedir $dh; my $result_path = "$dir/results"; make_path("$result_path"); for my $subdir ( sort @subdirs ) { chdir($dir); next unless -d $subdir; make_path("$result_path/$subdir"); my $search_text1 = qr/atom/; my $infile1="$subdir/input.txt"; my $in_fh1; if (!open $in_fh1, '<', $infile1) { goto NEXT if $!{ENOENT}; die qq{Failed to open "$infile1" for reading: $!}; } my $outfile1="$result_path/output"; open $in_fh1, '<', $infile1 or die qq{Failed to open "$infile1" for writing: $!}; open my $out_fh1, '>', $outfile1 or die qq{Failed to open "$outfile1" for writing: $!}; while (<$in_fh1>) { next unless /$search_text1/; my @fields1 = split; print $out_fh1 join("\t", @fields1[1]), "\n"; } close($in_fh1); close($out_fh1); NEXT: chdir(".."); }