Sponsored Content
Top Forums Shell Programming and Scripting Compare EDI files by skipping selected Segments Post 302307409 by Sivas on Wednesday 15th of April 2009 09:16:22 AM
Old 04-15-2009
Compare EDI files by skipping selected Segments

Hi,

I wanted to compare EDI files present in Two different Directories which can be related by the file names. While comparing the EDI files i have to skip selected segments such as "ISA" "IEA" and "GS" "GE" since this may have datetime stamp and different "Sender" "Receiver" Qual.

and create a report based on this. The directories may have unequal number of files. (i.e) some files may not have a pair in the other directory so have to be take care too..

Regards,
Siva
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

remove files other than selected

I wanna remove a set files other than some selected files. Eg. :rolleyes::rolleyes::rolleyes: a directory contains n files like test1.dat test2.dat test3.dat test4.dat out5.dat out1.dat i wanna remove all files which doesnot name like *test* I want to use this in shell... (22 Replies)
Discussion started by: freakygs
22 Replies

2. Shell Programming and Scripting

Compare selected columns from a file and print difference

I have learned file comparison from my previous post here. Then, it is comparing the whole line. Now, i have a new problem. I have two files with 3 columns separated with a "|". What i want to do is to compare the second and third column of file 1, and the second and third column of file 2. And... (4 Replies)
Discussion started by: kingpeejay
4 Replies

3. Shell Programming and Scripting

trying to print selected fields of selected lines by AWK

I am trying to print 1st, 2nd, 13th and 14th fields of a file of line numbers from 29 to 10029. I dont know how to put this in one code. Currently I am removing the selected lines by awk 'NR==29,NR==10029' File1 > File2 and then doing awk '{print $1, $2, $13, $14}' File2 > File3 Can... (3 Replies)
Discussion started by: ananyob
3 Replies

4. Shell Programming and Scripting

Compare selected columns of two files and print whole line with mismatch

hi! i researched about comparing two columns here and got an answer. but after examining my two files, i found out that the first columns of the two files are not unique with each other. all i want to compare is the 2nd and 3rd column. FILE 1: ABS 456 315 EBS 923 163 JYQ3 654 237 FILE 2:... (1 Reply)
Discussion started by: engr.jay
1 Replies

5. Shell Programming and Scripting

compare two files, selected columns only

hi! i have two files that looks like this file 1: ABS 123 456 BCDG 124 542 FGD 459 762 file 2: ABS 132 456 FGD 459 762 output would be: from file1: ABS 132 456 BCDG 124 542 from file 2: ABS 132 456 (4 Replies)
Discussion started by: kingpeejay
4 Replies

6. UNIX for Dummies Questions & Answers

Appending 2 files skipping the header of the second file

I have 2 files with the same header and need to append them and put the result in a 3rd file the 2 files has the same header and while appending i want to skip the second file header and need the result to be put in a third file Normally, this would work Cat file1 file2 >> file3....But how... (5 Replies)
Discussion started by: saggiboy10
5 Replies

7. Shell Programming and Scripting

unzip selected files

Hi, In file zip folder i have many files but i want to extract onlu .LOG file from the zip. How can i achive this Rajesh (3 Replies)
Discussion started by: guddu_12
3 Replies

8. Shell Programming and Scripting

Move only folders and skipping files

How do I move all folders and its contents from a directory A to another directory B, skipping all files in Directory A ? ---------- Post updated at 12:53 PM ---------- Previous update was at 12:42 PM ---------- Ok. Got it. mv /A/*/ /B/ (1 Reply)
Discussion started by: DHeisenberg
1 Replies

9. Shell Programming and Scripting

EDI File Parser

I've one EDI file which is to be parsed into 7 different file. I managed to extract required segments for a file(HEADER) to a separate file(sample3.dat) and is given below. $ cat sample3.dat REF*EI*273543997~ REF*2U*HELLO~ REF*G2*77685|132~ CLM*1000*0.00***12>B>1*N*A*Y*I~ CN1*05~... (5 Replies)
Discussion started by: ashokv3
5 Replies

10. Shell Programming and Scripting

Cp & skipping exiting files

// Redhat I am running a cron with cp every 15 minutes. cp /p2/arch/log/* /p2/bkp What I need is to not to copy the file again if the filename already exists under /p2/bkp The reason is that the file size under /p2/arch/log/ will be reduced (contents truncated), so I need to keep the... (10 Replies)
Discussion started by: Daniel Gate
10 Replies
Business::EDI(3pm)					User Contributed Perl Documentation					Business::EDI(3pm)

NAME
Business::EDI - Top level class for generating U.N. EDI interchange objects and subobjects. SYNOPSIS
use Business::EDI; my $edi = Business::EDI-new('d09b'); # set the EDI spec version my $rtc = $edi->codelist('ResponseTypeCode', $json) or die "Unrecognized code!"; printf "EDI response type: %s - %s (%s) ", $rtc->code, $rtc->label, $rtc->value; my $msg = Business::EDI::Message->new($ordrsp) or die "Failed Message constructor"; foreach ($msg->xpath('line_detail/all_LIN') { ($_->part(7143) || '') eq 'EN' or next; print $_->part(7140)->value, " "; # print all the 13-digit (EN) ISBNs } DESCRIPTION
The focus of functionality is to provide object based access to EDI messages and subelements. At present, the EDI input processed by Business::EDI objects is JSON from the edi4r ruby library, and there is no EDI output beyond the perl objects themselves. NAMESPACE
When you "use Business::EDI;" the following package namespaces are also loaded: Business::EDI::Segment_group Business::EDI::Message That's why the example message constructor in SYNOPSIS would succeed without having done "use Business::EDI::Message;" EDI Structure Everything depends on the spec. That means you have to have declared a spec version before you can create or parse a given chunk of data. The exception is a whole EDI message, because each message declares its spec version internally. EDI has a hierachical specification defining data. From top to bottom, it includes: Communication - containing one or more messages (not yet modeled here) Message - containing segment groups and segments Segment Group - containing segments Segment - containing composites, codelists and data elements Composite - containing multiple codelists and/or data elements Codelist - enumerated value from a spec-defined set Data Element - unenumerated value This module handles messages and everything below, but not (yet) communications. CLASS FUNCTIONS
Much more documentation needed here... new() Constructor OBJECT METHODS (General) value() Get/set accessor for the value of the field. code() The string code designating this node's type. The code is what is what the spec uses to refer to the object's definition. For example, a composite "C504", segment "RFF", data element "7140", etc. Don't be confused when dealing with CodeList objects. Calling code() gets you the 4-character code of the CodeList field, NOT what that CodeList is currently set to. For that use value(). desc() English description of the element. METHODS (for Traversal) part_keys() This method returns strings that can be fed to part() like: foreach ($x->part_keys) { something($x->part($_)) } This is similar to doing: foreach (keys %x) { something($x{$_}) } In this way an object can be exhaustively, recursively parsed without further knowledge of it. part($key) Returns subelement(s) of the object. The key can reference any subobject allowed by the spec. If the subobject is repeatable, then prepending "all_" to the key will return an array of all such subobjects. This is the safest and most comprehensive approach. Using part($key) without "all_" to retrieve when there is only one $key subobject will succeed. Using part($key) without "all_" to retrieve when there are multiple $key subobjects will FAIL. Since that difference is only dependent on data, you should always use "all_" when dealing with a repeatable field (or xpath, see below). Examples: my $qty = $detail->part('QTY'); # FAILURE PRONE! my @qtys = $detail->part('all_QTY'); # OK! xpath($path) $path can traverse multiple depths in representation via one call. For example: $message->xpath('all_SG26/all_QTY/6063') is like this function foo(): sub foo { my @x; for my $sg ($message->part->('all_SG26') { for ($sg->part('all_QTY') { push @x, $->part('6063'); } } return @x; } The xpath version is much nicer! However this is nowhere near as fully featured as W3C xpath for XML. This is more like a multple-depth part(). Examples: my @obj_1154 = $message->xpath('line_detail/SG31/RFF/C506/1154'); xpath_value($path) Returns value(s) instead of object(s). Examples: 'ORDRSP' eq $ordrsp->xpath_value('UNH/S009/0065') or die "Wrong Message Type!"; WARNINGS
This code is experimental. EDI is a big spec with many revisions. At the lower levels, all data elements, codelists, composites and segments from the most recent spec (D09B) are present. SEE ALSO
Business::EDI::Spec edi4r - http://edi4r.rubyforge.org AUTHOR
Joe Atzberger perl v5.12.4 2010-09-08 Business::EDI(3pm)
All times are GMT -4. The time now is 07:25 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy