Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Re^2: Trick to do one-liners on X12 files

by etcshadow (Priest)
on Sep 29, 2006 at 06:01 UTC ( [id://575471]=note: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    $/=\108;
    ($/) = (<> =~ /^.{105}(.?\r?\n?)/);
    seek ARGV, 0, 0;
    
  2. or download this
    # Look ahead into the file for the ISA segment and the few characters 
    +which
    #    follow it, so that we can determine the segment terminator charac
    +ter(s).
    ...
    # since we peeked ahead into the file, to determine *how* to read it, 
    +now
    #    seek back to the beginning of it, so that we can read it (all) co
    +rrectly
    seek ARGV, 0, 0;
    
  3. or download this
    #!/bin/sh
    
    ...
    fi
    
    perl -l -$looptype -e 'BEGIN{$SIG{PIPE}="exit"; $|=1; $/=\108; ($f,$c,
    +$/)=(<> =~ /^ISA(.).{100}(.)(.?\r?\n?)/); ($f,$c)=("\Q$f","\Q$c"); se
    +ek ARGV,0,0; $.=0}' -F'/$f/' "$@"
    
  4. or download this
    $ x12cat -ne 'print if /^GS/' some_file.x12
    
  5. or download this
    $ x12cat -ane '$paid += $F[4] if $F[0] eq "CLP"; END{print $paid}' som
    +e_835_file.x12
    
  6. or download this
    ------------
    :Wq
    Not an editor command: Wq
    

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://575471]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others studying the Monastery: (5)
As of 2024-04-19 07:46 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found