CAS*CO*999*999.99~ LX*2~ #### SVC*HC:00003*999.99*999.9**1~ #### use warnings; use strict; #Note that this script throws errors when pull file paths are defined. #Must be run from the path that the input/output files exist. open my $fhi, '<', 'cr835.txt' or die "$!"; open my $fho, '>', 'cr_output.txt' or die "$!"; #Prints the first 14 lines to the output file while(<$fhi>) { 1 .. 14 ? print : last; } close $fhi; close $fho; system( q(perl -nle "print if /SE\Q*\E3841/ .. /IEA\Q*\E/" "cr835.txt") );