How to replace specific line positions in sed

sed

I need to be able to use sed (or anything else) to replace a specific line position, I'm Googleing and can't find anything (yet).

* UPDATE *

this is what I came up so far..

sed 's|\(^.\{67\}\).\{1\}||g' $$

yet this deletes everything from beginning to position 67+1, I want ONLY position 67+1 to be gone..

Best Answer

I first believed youd need this. This will match 66 characters \(.\{66\}\) and store it in \1, put the next two \(.\{2\}\) in \2, and everything else \(.*\) in \3 it will substitute \1\2\3 with \1\3, disappearing you 2 characters you dont want.

sed 's/^\(.\{66\}\)\(.\{2\}\)\(.*\)/\1\3/'

And then I remembered this. This will substitute 2 characters '..' for '' at character 67.

sed 's/..//67'
Related Topic