I assumed that the following lines (but with spaces instead of commas):
8989,,123,,z8z,,134.5,,123,,
,,000,,
-u2 -z
*,,123,,*
#,,456,,#
\n,,789,,\n
,,12,,
,,34,,
,,56,,
,,.,,
,,.123,,, ,,1.23,, ,,123.,, ,,123,,
,,123,,, ,,123.,, ,,1.23,, ,,.123,,
should convert (but with spaces instead of commas) to
8989,,xxx,,z8z,,xxx.x,,123,,
,,xxx,,
-u2 -z
*,,xxx,,*
#,,xxx,,#
\n,,xxx,,\n
,,12,,
,,34,,
,,56,,
,,.,,
,,.xxx,,, ,,x.xx,, ,,xxx.,, ,,xxx,,
,,xxx,,, ,,xxx.,, ,,x.xx,, ,,.xxx,,
Rather than restricting myself to sed, as the original poster had
suggested,, I restricted myself to using **only** ksh built-ins (i.e.,
no sed, awk, perl, tr, ). Unfortunately, my solution swelled to 66
lines of code, so I decided not to include it here. I can email it
directly to anyone who wants it.
Regards,
Dan R.