]> git.evergreen-ils.org Git - working/Evergreen.git/blob - edi_scratch/edi_splitter.pl
Update comment (trivial)
[working/Evergreen.git] / edi_scratch / edi_splitter.pl
1 #!/usr/bin/perl
2 #
3 #
4 # Purpose here is to break up EDI messages to make them more readable
5 # (i.e., not all on one line).
6 #
7
8 use warnings;
9 use strict;
10
11
12 my @unindented = qw( LIN BGM );
13
14 my $delim = "'";
15 while (my $line = <>) {
16     foreach (split $delim, $line) {
17         '+' eq substr($_,3,1) or warn "Line $. missing '+' delimiter as 4th character: $_";
18         my $tag = substr($_,0,3) or warn "Line $. Unexpectedly short: $_";
19         unless ($tag =~ /^UN\S/ or grep {$_ eq $tag} @unindented) {
20             print "\t";
21         }
22         print "$_$delim\n";
23     }
24     print '=' x 70, "\n\n";
25 }
26