parsing issue with edi file

Hello,
We have edi files we need to do some extra parsing on.

There is a line that shows up that looks like this:
GE|8,845|000000000

We need to parse the file, find the line ( that begins with GE "^GE" ), and remove the comma(s).

What is the easiest way to do that ? I know I can grab the line individually, fix it and then remake the file again, inserting the line in the proper place.
But I think there should be a proper awk or sed combo that will easily do it for me.

Any help is appreciated.

Thanks,
Floyd

try:

awk '/^GE/ {gsub(",","")}; {print $0}' infile> outfile

That worked !!

Thanks very much.

Floyd

---------- Post updated at 02:36 PM ---------- Previous update was at 12:45 PM ----------

Hate to bother you again, but I have just been handed a little wrench.

Sometimes the files are comma delimited.

how can I solve this problem then ?

Thanks,
floyd

How would you know the difference in comma's when there are comma's as delimiers between fields and comma's inside the fields?
Sometimes fields are inside quotes " characters.
Can you show a sample?

if its a comma delimited file then you must have some precise pattern to locate fields..
i mean fixed field length or field pattern such as no or not etc etc...

Yea upon thinking more about it, I don't see any way, unless as has been said, we can know the exact width of each field. Right ?

so suppose this is the record.

GE,11,029,000000000

if we know that the first field must be 2 characters, the second field must be 6 characters and the 3rd field must be 9 characters, then can we do something to get rid of the faulty comma between the 11 and the 0 ?

Thanks,
floyd