in reply to Substrings of unusual size!
You could try using split. split G records with : as a delimiter & E records with |.
then you don't care what length things are, only which fields you're interested in.