Unfortunately this chap has been banned for some reason and I was looking forward to the resolution of his question: -
He was asking if you can use sed to match a pattern you want to replace within a restricted range of characters in a string. Can anyone tell me how to do this?
He wanted to change: -
21111111110001343 000001004OLF-AA029100020091112
to: -
21111111110001343 000001004OLF-1E029100020091112
But I don't want a generic match that matches the whole line, just that range highlighted in blue. Is it possible to do this using sed?
putting tools to use aside, let's think logically. if you want to replace position 28 to 33, then print from position 1 to 27, then print the new replacement, then print from 34 onwards...
pseudocode:
Thanks for the replies but I don't think that they quite do what I am asking for. I want to combine the replacement of the characters within the range while matching the pattern.
So the replacement only occurs if the pattern is present within that specific range of characters.