I want to replace a line that is 5 lines above the current line in the vi editor. It has to be a single command in the ex mode.
use
:-5s/^.\*$/Your Replacement/
That should work, and will move the cursor to that line
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.