edifact2awk 1.0

edifact2awk is a small C program that parses an EDIFACT file and converts it to a flat text file.
edifact2awk is a small C program that parses an EDIFACT file and converts it to a flat text file which may then be easily parsed by the AWK textprocessing language (including by other script languages like Perl, Python, Visual Basic, etc.). It interprets the UNA segment and performs the following modifications:

the segment separator is replaced by a newline
the data element separator is replaced by a tab
the component data element separator is replaced by a dollar symbol $
the release character is interpreted

edifact2awk reads the EDIFACT file on the standard input stream (stdin) and outputs the flat text file on the standard output stream (stdout). The program is safe from buffer overflow attacks as it is completely stream orientated and can handle any segment sizes without using internal buffers and dynamic memory. Here is an example which shows how it may be used on the UNIX commandline:

edifact2awk < edifactfile | awk -f awkscript

AWK script:

The AWK script may be structured in the following way (example):

BEGIN {
FS = "t"
}

$1 == "UNB" {
exp = $3
prep = $5

...
}

$1 == "NAD" && $2 == "CR4" {
func = $2
trav = $5

...
}

...

END {
...
}


The component data elements cannot be automatically separated by AWK. You have to use the index function to search for the dollar symbol and use substr to separate the component data elements.

Compilation:

edifact2awk should compile on any ANSI C compiler and run on any platform (including Windows). Here is an example which shows how it may be compiled on UNIX:

cc -O2 -o edifact2awk edifact2awk.c
strip edifact2awk

last updated on:
July 28th, 2008, 13:09 GMT
price:
FREE!
developed by:
Patrick Kaell
homepage:
sourceforge.net
license type:
GPL (GNU General Public License) 
category:
ROOT \ Text Editing&Processing \ Others

FREE!

In a hurry? Add it to your Download Basket!

user rating 18

3.1/5
 

0/5

Rate it!

Add your review! 1 USER REVIEW SO FAR

SUBMIT