Ixandantilus has asked for the wisdom of the Perl Monks concerning the following question:
{ $buffer = ''; $filename = ''; $line = ''; $job = ''; $temp = ''; $index_job = 0; $key = ''; $tray = ''; print LOG "$mday$mon$year $hour:$min:$sec Processing Data file, s +plitting Jobs.\n"; # Skip first line. #<INFILE>; while (<INFILE>) { $line = $_; if ($line =~ /^(\^JOB.*)\n$/i) #if the current line is a ^job +line then { $tmp = $1; #Set $tmp equal to what is in (\^JOB.*) ie: ^jo +b PATIENTLBL -c1 -zDP7P @pieces = split(/ /, $tmp); #Split-up the entire line, on +spaces, into @pieces $newjob = $pieces[0]." "."JF".$pieces[1]." ".$pieces[2]." +".$pieces[3]."\n"; #Rebuild ^job line with JF in front of jobname #print "newjob : ".$newjob; $temp = $newjob; #Assign new ^job line to $temp to create +new file(s) if ($buffer ne "") #Not first job { print LOG "$mday$mon$year $hour:$min:$sec Found: $jo +b"; $buffer_job[$index_job++] = $buffer; } $job = $temp; $buffer = $temp; }else{ $buffer .= $line; } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Text Processing
by arturo (Vicar) on Apr 21, 2001 at 00:48 UTC | |
|
Re: Text Processing
by Sprad (Hermit) on Apr 21, 2001 at 00:45 UTC | |
by arturo (Vicar) on Apr 21, 2001 at 00:55 UTC | |
by Sprad (Hermit) on Apr 21, 2001 at 01:15 UTC | |
by arturo (Vicar) on Apr 21, 2001 at 01:18 UTC | |
|
Re: Text Processing
by Sifmole (Chaplain) on Apr 21, 2001 at 00:36 UTC | |
by Ixandantilus (Initiate) on Apr 21, 2001 at 00:44 UTC | |
by Sifmole (Chaplain) on Apr 21, 2001 at 00:53 UTC | |
|
Re: Text Processing
by greenFox (Vicar) on Apr 21, 2001 at 02:13 UTC | |
|
Re: Text Processing
by Ixandantilus (Initiate) on Apr 21, 2001 at 06:48 UTC |