LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 10-16-2013, 09:19 AM   #1
josephkram54
LQ Newbie
 
Registered: Oct 2013
Posts: 2

Rep: Reputation: Disabled
xtracting entire sets from an X12 file


Hello
I work with X12 EDI files and many times need to extract entire sets based on the sender ID
Is there a way to do a find on sender ID 01*xxxxxxxxxx
and then extract all data between and including the ISA/IEA

thanks so much
 
Old 10-16-2013, 09:40 AM   #2
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 19,324

Rep: Reputation: 4471Reputation: 4471Reputation: 4471Reputation: 4471Reputation: 4471Reputation: 4471Reputation: 4471Reputation: 4471Reputation: 4471Reputation: 4471Reputation: 4471
Quote:
Originally Posted by josephkram54 View Post
Hello
I work with X12 EDI files and many times need to extract entire sets based on the sender ID
Is there a way to do a find on sender ID 01*xxxxxxxxxx
and then extract all data between and including the ISA/IEA

thanks so much
Probably...but you don't post any sample input data, or tell us exactly what you want for output. And we don't know what version/distro of Linux you're using, or ANY details (file sizes, how often to run this, etc.) Hard to answer a question without details.
 
Old 10-16-2013, 10:23 AM   #3
josephkram54
LQ Newbie
 
Registered: Oct 2013
Posts: 2

Original Poster
Rep: Reputation: Disabled
here is a sample file. There would be multiple files together but I need to do a find on ZZ*xxxxxxx and then print out in same format the lines beginning with ISA and ending in IEA that contain the initial string. I would then reprocess those files through our system. I am looking for a script that I could run .
ISA*00* *00* *ZZ*xxxxxxx *01*001317452L *131016*0634*X*0200 *000030794*
0*P*;
GS*CG*xxxx*OC*131016*0634*30794*X*003030
ST*990*307940001
B1*xxxx*751407xxxx**A
N9*CN*IN32332
SE*4*307940001
ST*990*307940002
B1*xxxx*751407xxxx**A
N9*CN*IN32333
SE*4*307940002
ST*990*307940003
B1*xxxx*850029xxxx**A
N9*CN*IN32335
SE*4*307940003
ST*990*307940004
B1*xxxx*850031xxxx**A
N9*CN*IN32336
SE*4*307940004
ST*990*307940005
B1*xxxx*8500339287**A
N9*CN*IN32338
SE*4*307940005
GE*5*30794
IEA*1*000030794
 
Old 10-16-2013, 11:29 AM   #4
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 19,324

Rep: Reputation: 4471Reputation: 4471Reputation: 4471Reputation: 4471Reputation: 4471Reputation: 4471Reputation: 4471Reputation: 4471Reputation: 4471Reputation: 4471Reputation: 4471
Quote:
Originally Posted by josephkram54 View Post
here is a sample file. There would be multiple files together but I need to do a find on ZZ*xxxxxxx and then print out in same format the lines beginning with ISA and ending in IEA that contain the initial string. I would then reprocess those files through our system. I am looking for a script that I could run .
Code:
ISA*00*          *00*          *ZZ*xxxxxxx        *01*001317452L     *131016*0634*X*0200 *000030794*
You've posted sample data that doesn't contain what you're looking for??? The only string that has ZZ..... in it is above, but doesn't terminate with IEA. Again, can you post a sample of what you're actually looking for, and a sample of what you want to get OUT? There were several other questions in my first reply which you haven't answered either. Again, without details, there's not much we can help with.

A short hint would be to run the input file through grep for "ZZ*", which will pull out all the lines with ZZ* in them. From there, your script could read that input file, to see if the beginning/ending is what you're after. Can you also post what you've written/tried so far?
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
File browsers Nautilus, Dolphin not showing RAID sets, but member disks on Fedora 16 Polo_Talnir Fedora 1 06-04-2012 08:26 PM
File browsers Nautilus, Dolphin not showing RAID sets, but member disks on Fedora 16 Polo_Talnir Linux - Desktop 0 05-06-2012 04:51 PM
[SOLVED] Sometimes not getting entire file when printing to a file in SeaMonkey blackhole54 Linux - Software 2 08-07-2009 12:44 AM
LXer: Mirth 1.4 Released with HL7 v3, X12 and EDI Support LXer Syndicated Linux News 0 03-24-2007 03:31 AM
Can't read entire file from CD under RH7.1 t0dd Linux - General 2 01-28-2002 01:40 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 12:20 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration