I am not sure why you are confused?
Easy enough to look at your examples:
Code:
awk -v RS="~ST" -v FS="*" '{ print $3}'
This will make the records look like:
Code:
ISA*00*<----Sectors---->
*837*030702343*<------MOre SEctors------->~CLM*7868*XXX***<-------More SEctors---->~SE*40*030702343~(more "
<------>~SE----->" sections)
So the third fields are:
Code:
<----Sectors---->
030702343
#note there is a line here but it is blank as only a single field
Then for example 2:
Code:
awk -v RS="~CLM" -v FS="*" '{ print $2}' SSS_SELECTO_10092.x12
This will make the records look like:
Code:
ISA*00*<----Sectors---->~ST*837*030702343*<------MOre SEctors------->
*7868*XXX***<-------More SEctors---->~SE*40*030702343~(more "~ST<------>~SE----->" sections)
And so second fields are:
You are the one indicating what a record should look like. So where is your confusion?