I use this little script for EDI parsing. It will add a linebreak after a character it finds.
Usage:Code:#!/bin/sh -vx # Script to add line breaks after the delimiter of an EDI file. # Paramters: filename input file (edi data file) # output file to be written # delimiter ending delimiter of EDI file (\, *, ~, etc) ############################################################################ # Variables filename=$1 output=$2 delim=$3 replace='s/'$delim'/\n/g' cat $1 | tr -d "\n" > $output.br4 cat $output.br4 | sed -e $replace > $output
Text Sample:Code:# linebreak.sh <filename> <output filename> <delimiter>
Example:Code:v1,v2*v3,v4*v5,v46*
Note: You have to escape special charactersCode:# linbreak.sh /example.txt /example_parsed.txt \*
Output:
Code:v1,v2* v3,v4* v5,v46*
How many languages did you write this EDI parser in?
This isn't an EDI parser but a customized program for an ERP program we have. It was unable to handle reading text files without linebreaks.
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks