Carlos If you can wait a few days (I've got a few billable things to do), I can write something in Python... It s/b compatible with both Windows & Unix/Linux...
Can you run Python on your system? To: "Hurd, Richard [SLCUS]" <[EMAIL PROTECTED]> Copies to: [email protected] From: [EMAIL PROTECTED] Date sent: Wed, 11 Apr 2007 14:42:29 -0400 Subject: RE: [EDI-L] Gentran edifrmat replacement on Unix? > The softshare tool is Windows-based. I need to write a Unix script (AWK?, > SED?) to parse a file with multiple ISAs and multiple ISA106 characters, as > occurs when I receive a file from the VAN with multiple partners' data. > I've played around with td and some other native Unix, and I can handle the > situation where the ISA106 is consistent, but not when it changes from ISA > to ISA. In a nustshell, what I need to do is capture the ISA106 of the > first ISA and replace the entire envelope with a \015, then capture the > ISA106 from the next ISA, and so on. It'll be clearer from the example > below. In here, I have 2 ISAs, one with ISA106=} and another with [EMAIL > PROTECTED] > The end result I want is also below: > > Input: > > ISA~00~ ~00~ ~01~123456789 ~16~999999999 > ~070410~0928~U~00400~000000277~0~P~>}GS~FA~123456789~999999999~20070410~0928~277~X~004010}ST~997~0419}AK1~PO~809}AK2~850~0001}AK5~A}AK9~A~1~1~1}SE~6~0419}GE~1~277}IEA~1~000000277}ISA~00~ > ~00~ ~14~222222222 ~16~999999999 > ~070410~0831~U~00400~000013464~0~P~>@[EMAIL PROTECTED]@[EMAIL PROTECTED] > > [EMAIL PROTECTED]@[EMAIL PROTECTED]@[EMAIL PROTECTED]@[EMAIL > PROTECTED]@IEA~1~000013464@ > > Output: > > ISA~00~ ~00~ ~01~123456789 ~16~999999999 > ~070410~0928~U~00400~000000277~0~P~> > GS~FA~123456789~999999999~20070410~0928~277~X~004010 > ST~997~0419 > AK1~PO~809 > AK2~850~0001 > AK5~A > AK9~A~1~1~1 > SE~6~0419 > GE~1~277 > IEA~1~000000277 > ISA~00~ ~00~ ~14~222222222 ~16~999999999 > ~070410~0831~U~00400~000013464~0~P~> > GS~PR~222222222~999999999~20070410~0831~13464~X~004010 > ST~855~0001 > BAK~06~AC~3000111134~20070406~~~~~20070410 > N1~ST~COMPANY NAME~92~096600 > N1~VN~VENDORXXXXXX > PID~F~~~~TEXT DESCRIPTION > ACK~AC~1~EA~017~20070417 > CTT~1 > SE~9~0001 > GE~1~13464 > IEA~1~000013464 > > > > > > > > "Hurd, Richard > > [SLCUS]" To: "ec_edi" <[EMAIL > PROTECTED]>, [email protected] > <[EMAIL PROTECTED] cc: > > .com> Subject: RE: [EDI-L] Gentran > edifrmat replacement on Unix? > > > 04/11/2007 02:11 > > PM > > > > > > > > > > I remember doing something like that with 'awk' but it wouldn't be as nice > as a fullblown tool. > > > With awk, if you set the record separator to the 106th byte in the ISA > record, and the field separator to the fourth byte, you can use it to do > rudimentary parsing. > > > Much easier to use a tool like the Softshare one. Must go find that one on > their web site. :) > > > > > > -----Original Message----- > From: [email protected] [mailto:[EMAIL PROTECTED] > Sent: Wednesday, April 11, 2007 8:54 AM > To: [email protected] > Subject: [EDI-L] Gentran edifrmat replacement on Unix? > > > > > > I'm looking to mimic what Gentran's edifrmat command does using a unix > script or command. We are removing Gentran but would like the > functionality provided by edifrmat, for example, when viewing EDI > files, we run edifrmat on the file and redirect the output to a text > file that we can then read, with carriage returnes, etc. We'd like to > have a similar capability with simple command line Unix. My thinking > is we need to parse through an EDI file, extract poswition 106 from > the ISA, and replace it with a CR. I have a simple td command that > works, but only when the ISA06 field is consistent throughout the file. > > > > > > > > > ... > Please use the following Message Identifiers as your subject prefix: > <SALES>, <JOBS>, <LIST>, <TECH>, <MISC>, <EVENT>, <OFF-TOPIC> > > > Job postings are welcome, but for job postings or requests for work: <JOBS> > IS REQUIRED in the subject line as a prefix. > > > Yahoo! Groups Links > > > > > > > > > > > > > > > > > > ... > Please use the following Message Identifiers as your subject prefix: <SALES>, > <JOBS>, <LIST>, <TECH>, <MISC>, <EVENT>, <OFF-TOPIC> > > Job postings are welcome, but for job postings or requests for work: <JOBS> > IS REQUIRED in the subject line as a prefix. > Yahoo! Groups Links > > > > > > > __________ NOD32 2181 (20070411) Information __________ > > This message was checked by NOD32 antivirus system. > http://www.eset.com > > Earl Wertheimer [EMAIL PROTECTED] http://www.spe-edi.com ... Please use the following Message Identifiers as your subject prefix: <SALES>, <JOBS>, <LIST>, <TECH>, <MISC>, <EVENT>, <OFF-TOPIC> Job postings are welcome, but for job postings or requests for work: <JOBS> IS REQUIRED in the subject line as a prefix. Yahoo! Groups Links <*> To visit your group on the web, go to: http://groups.yahoo.com/group/EDI-L/ <*> Your email settings: Individual Email | Traditional <*> To change settings online go to: http://groups.yahoo.com/group/EDI-L/join (Yahoo! ID required) <*> To change settings via email: mailto:[EMAIL PROTECTED] mailto:[EMAIL PROTECTED] <*> To unsubscribe from this group, send an email to: [EMAIL PROTECTED] <*> Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/
