Hi Forum.
I'm running the following awk command to extract the suffix value (pos 38) from the "AM00" record and append to the end of the "AM01" record.
awk 'substr($0,13,4)=="AM00" {SUFFIX = substr($0,38,2)} substr($0,13,4)=="AM01" {$0 = $0 SUFFIX} 1' before.txt > after.txt
Before.txt:
000000000001AM00 1500895700000000000187
000000000001AM01 035000000000013000399820810000000
AM01 record - In hex value:
.....20 20 20 20 20 20 0D 0A
After.txt:
000000000001AM00 1500895700000000000187
000000000001AM01 03500000000001300039982081000000087
AM01 record - In hex value:
.....20 20 20 20 20 20 38 37 0A
It seems or appears that the Hexadecimal 0D was removed after running the awk command.
Any way to resolve this?
Thanks.