Hi All...
I have what is probably a very easy question for the experts that patrol this board...
I have a fixed-width file with four 10-byte fields (field 1 = bytes 1-10, field 2 = bytes 11-20, field 3 = bytes 21-30, field 4 = bytes 31-40). Some of the fixed-width fields contain no spaces, or 'unused' bytes (as in line one of the input below), some contain spaces in the last bytes of the field (as in line two of the input below), and some contain spaces between bytes of data within the field (as in line three of the input below).I need to use nawk, or some other unix utility (sed, etc.) to convert it into a pipe-delimited file. I don't want any actual data truncated, except for trailing spaces.
So, the input looks like this (without the 'ticks'):
'1234567890123456789012345678901234567890'
'12345 1234567 12 1234567890'
'123 6789012345 78 12345 1234567890'
I need the output to look like this (without the 'ticks'):
'1234567890|1234567890|1234567890|1234567890'
'12345|1234567|12|1234567890'
'123 67890|12345 78|12345|1234567890'
I'd like to eventually put this into a ksh script, if that makes any difference. As always, any help would be GREATLY appreciated!
I have what is probably a very easy question for the experts that patrol this board...
I have a fixed-width file with four 10-byte fields (field 1 = bytes 1-10, field 2 = bytes 11-20, field 3 = bytes 21-30, field 4 = bytes 31-40). Some of the fixed-width fields contain no spaces, or 'unused' bytes (as in line one of the input below), some contain spaces in the last bytes of the field (as in line two of the input below), and some contain spaces between bytes of data within the field (as in line three of the input below).I need to use nawk, or some other unix utility (sed, etc.) to convert it into a pipe-delimited file. I don't want any actual data truncated, except for trailing spaces.
So, the input looks like this (without the 'ticks'):
'1234567890123456789012345678901234567890'
'12345 1234567 12 1234567890'
'123 6789012345 78 12345 1234567890'
I need the output to look like this (without the 'ticks'):
'1234567890|1234567890|1234567890|1234567890'
'12345|1234567|12|1234567890'
'123 67890|12345 78|12345|1234567890'
I'd like to eventually put this into a ksh script, if that makes any difference. As always, any help would be GREATLY appreciated!