Hi I am trying to pattern match with sed, if it finds a match I need it to insert characters at the 28th position, its working but its also adding an extra space and I don't know why, below is the code.
sed 's/715023044/\n&/g' $asn | sed '/^71502304413-000/s/./B4/28' | sed -e :a -e '$!N;s/\n//;ta' > tmp.tmp
Original
71502304413-000 00000000000010010000000000000
New
71502304413-000 B4 0000000000001001000000000000
As you can see on the bottom line it has added an extra space, any ideas?
I can't see it having an extra space. You are replacing ONE arbitrary char by B4 (2 chars), so everything is shifted 1 pos back. What surprises me is that the lines have identical length.
New to this so never thought of it like that but makes sense, is there anyway to insert at position 28 and overwrite hence not adding an extra character?