Beefy Boxes and Bandwidth Generously Provided by pair Networks
Come for the quick hacks, stay for the epiphanies.

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

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

Help for this page

Select Code to Download

  1. or download this
    ($/) = (<> =~ /^.{105}(.?\r?\n?)/);
    seek ARGV, 0, 0;
  2. or download this
    # Look ahead into the file for the ISA segment and the few characters 
    #    follow it, so that we can determine the segment terminator charac
    # since we peeked ahead into the file, to determine *how* to read it, 
    #    seek back to the beginning of it, so that we can read it (all) co
    seek ARGV, 0, 0;
  3. or download this
    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
  6. or download this
    Not an editor command: Wq

Log In?

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

How do I use this?Last hourOther CB clients
Other Users?
Others musing on the Monastery: (4)
As of 2023-12-09 22:30 GMT
Find Nodes?
    Voting Booth?
    What's your preferred 'use VERSION' for new CPAN modules in 2023?

    Results (38 votes). Check out past polls.