If it's just about that particular `K`, then getting rid of the `g` flag will do, as `sed` will only replace `K` once. Thus:
sed -i "4s/K/exc/"
Namely, it replaces the first appearance of `K` with `exc` on line 4.
If it's just about that particular `K`, then getting rid of the `g` flag will do, as `sed` will only replace `K` once. Thus:
sed -i "4s/K/exc/"
Namely, it replaces the first appearance of `K` with `exc` on line 4.