I need a way to convert an ASCII character (the % sign) to it's corresponding octal value (045) on the unix platform.
I have attempted to do this conversion using the following unix commands, and I haven't had any success.
sed, tr.
Here is a sample of the data file: (octal dump)
0000120 0 0 0 9 0 * 0 * P * % \n G S * H
060 060 060 071 060 052 060 052 120 052 045 012 107 123 052 110
And here is what I am looking for:
0000120 0 0 0 5 2 * 0 * P * \0 \0 \0 % \n G
060 060 060 065 062 052 060 052 120 052 000 000 000 045 012 107
The file was originally created on an hp-3000, which allowed for the use of octal values (control values). The program that produced this output would write out the value using the following clause: pic s9(04).
I have also tried to do the conversion using micro focus cobol, but as far as I can tell, mfc does not like octal values.
So, let me know if you know of a unix command that will change the value.
Thanks for your assistance in advance.
I have attempted to do this conversion using the following unix commands, and I haven't had any success.
sed, tr.
Here is a sample of the data file: (octal dump)
0000120 0 0 0 9 0 * 0 * P * % \n G S * H
060 060 060 071 060 052 060 052 120 052 045 012 107 123 052 110
And here is what I am looking for:
0000120 0 0 0 5 2 * 0 * P * \0 \0 \0 % \n G
060 060 060 065 062 052 060 052 120 052 000 000 000 045 012 107
The file was originally created on an hp-3000, which allowed for the use of octal values (control values). The program that produced this output would write out the value using the following clause: pic s9(04).
I have also tried to do the conversion using micro focus cobol, but as far as I can tell, mfc does not like octal values.
So, let me know if you know of a unix command that will change the value.
Thanks for your assistance in advance.