I want to append each line in a file in .KSH script with XXX with position starting from 31 to 33 in the above file the first record on the position 31-33 empty space is there.. i want to replace with XXX only on this position.
I would try something with cut -d' ' -f3 so that when there is no space there isn't no third field too.
so test the third field and if not empty add 'XXX' at the beginning of that field. Concatenate with the fisrt two fields and it's done.
I can give you an idea of scripting that in bash if you want.
oops ! maybe danmero has found something better with awk !