edifact2awkedifact2awk is a small C program that parses an EDIFACT file and converts it to a flat text file. | |
Download |
edifact2awk Ranking & Summary
Advertisement
edifact2awk Tags
edifact2awk Description
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 interpretededifact2awk 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 awkscriptAWK 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
edifact2awk Related Software