I am trying to change a hex value of 0D to 0D0D0A so I really need to replace one character with three characters which is what I think is making it tricky.
It seems to me that there lines in DOS format, that are ending with CR (0D) - LF (0A) , and there are also FF characters (0C). But what do you want to do with them? Why do you want to change 0D to 0D0D0A ?
OK, it appears I have muddied the waters by only explaining what I think I need.
Given that my knowledge is poor at best i'll explain the whole problem to try and give it context which will hopefully help.
I have a file which contains a hex value of 01 at the beginning of each 'record' and a hex value of '03' at the end of each record.
Within each record there are several 'lines' of data that end with a hex value of '0D0A'
So the data would look like this (crlf signifies a carriage return/line feed)
^AHIcrlf
BYEcrlf
-}^C
If I look at it in a HEX viewer I see
01 48 49 0D 0A
42 59 45 0D 0A
2D 7D 03
The problem I have is that the application I need to put the file into has the following restrictions
The ^A character(hex value of 01) needs to be replaced with a space(hex value 20). So, I want to replace hex 01 with hex 20
The ^C character(hex value 03) needs to be replaced with a carriage return and two line feeds(hex values 0D 0A 0A). So, I want to replace hex 03 with hex 0D 0A 0A.
What I want to end up with is
20 48 49 0D 0A
42 59 45 0D 0A
2D 7D 0D 0A 0A
Hopefully that makes what i'm aiming for a little clearer and apologies for not being accurate enough initially.