I'm trying to write a .ksh script that will take an input file that contains records that are 10 bytes long, and then, based on the first character, append an eleventh character. If the first character of the record = 'H', I want the script to append an 'A' to the end of the record (as byte 11). If the first character of the record = 'D', I want the script to append an 'B' to the end of the record (as byte 11). If the first character of the record = 'T', I want the script to append an 'C' to the end of the record (as byte 11).
So, if my input looks like this (without the single-quotes):
'Hxxxxxxxxx'
'Hxxxxx '
'Dxxxxxxxxx'
'Dxxxxxxx '
'Txxxx '
'Txxxxxxxxx'
I want my output to look like this (again, without the single-quotes):
'HxxxxxxxxxA'
'Hxxxxx A'
'DxxxxxxxxxB'
'Dxxxxxxx B'
'Txxxx C'
'TxxxxxxxxxC'
I don't know if I can do this with sed or nawk or something... If you have any suggestions, please let me know... Thanks!
So, if my input looks like this (without the single-quotes):
'Hxxxxxxxxx'
'Hxxxxx '
'Dxxxxxxxxx'
'Dxxxxxxx '
'Txxxx '
'Txxxxxxxxx'
I want my output to look like this (again, without the single-quotes):
'HxxxxxxxxxA'
'Hxxxxx A'
'DxxxxxxxxxB'
'Dxxxxxxx B'
'Txxxx C'
'TxxxxxxxxxC'
I don't know if I can do this with sed or nawk or something... If you have any suggestions, please let me know... Thanks!