edifact2awk is a C program that converts EDIFACT files to flat text files. It's a small program designed to simplify data parsing and manipulation.Exporting file to Excel or other text-based programs, for example, is made easier thanks to this program.
edifact2awk understands the UNA segment and does the following conversions: replaces the segment separator with a newline, the data element separator with a tab, the component data element separator with a dollar symbol $ and interprets the release character. It reads the EDIFACT file from the standard input stream and generates the flat text file on the standard output stream.
One of the biggest advantages of edifact2awk is that it is safe from buffer overflow attacks as it works in a stream-oriented manner and can handle any segment sizes without using internal buffers or dynamic memory.
Here's an example of how you can use it on the UNIX command line: edifact2awk < edifactfile | awk -f awkscript. The AWK script can be structured in a specific way that allows you to search for specific segments and perform any necessary tasks.
However, be warned that component data elements cannot be automatically separated by AWK. You will need to use the index function to find the dollar symbol and then use substr to separate the component data elements.
The beauty of edifact2awk is that it should compile on any ANSI C compiler and run on any platform, including Windows. You can compile it with the following command on UNIX: cc -O2 -o edifact2awk edifact2awk.c; strip edifact2awk.
Overall, if you need to convert EDIFACT files into flat text files, give edifact2awk a try. Its ease of use and compatibility with various scripting languages make it a great asset to have in your software toolbox.
Version 1.0: N/A