Linux - NewbieThis 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
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
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
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.
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
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 .
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?
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.