If you're going to all this effort you should change the outer too, not just the inner.
To decide what is inside the frame for internal routing.
First, push/pull the outer housing where it passes through the frame. Watch the other end for movement. If if moves you have continuous housing which is easy.
- First, if you will need a cable ferrule at the brake/gear lever, fit it to the inner cable before threadding
- Simply remove the old inner and fit a replacement.
- To change the outer, you hold the new inner and pull the outer, leaving the inner in place through the frame.
- Cut your new outer to length compared to the old one.
- Feed the new outer over the new inner from the back, so that the new inner works as a lead wire. Ideally your new inner will be long enough to pop out the end of the outer before the front end of the outer enters the frame, to give you something to hold.
- When the front of the outer hits the frame exit, you'll probably need to jiggle it to line up.
- Finally fit the rear ferrule and seat both ends, then fit the inner to the rear brake caliper or the front/rear derailleur as appropriate.
Otherwise it gets harder because you have cable stops at the entrance/exit. If the cable stops are joined internally by some guide, then its also easy to pull the inner and push the new one through. HOWEVER if you have bare inner cable between the cable stops that is the hardest, and I don't have a good answer.
- Pull the old inner wire
- Cut and fit pieces of outer to the right length, fit ferrules.
- Push the inner from front to back.
- If it doesn't pop out the rear cable stop, then you have no internal housing and need a bike shop to do it, or look at buying the cable tools.
Also, some bikes have cable stops that can be removed to show a larger hole in the frame. If your rear cable stop comes out, then you can use a loop of string or tape or even a small magnet to fish the steel inner cable from the frame.
Note stainless steel is not as magnetic as regular steel.