!1255:p
Will do this
!
is history recall
1255
is the line number
:p
prints but does not execute
Then you can use up-arrow to get ther previous (unexecuted) command back and you can change it as you need.
I often combine this with hg
("History Grep") - my favorite alias.
$ alias hg # Maybe use hgr instead if you are a Mercurial CLI user.
alias hg='history | tail -200 | grep -i'
This searches for text on a recent history line, regardless of case and is used this way:
When I want to search for recent vi commands to edit a certain file and then I want to re-use one of them to edit the same file but with a different file extension.
$ hg variables
6153 vi Variables/user-extensions.js
6176 vi Variables/user-extensions.js
6178 vi Variables/user-extensions.js
6190 vi Variables/user-extensions.js
6230 hg variables
$ # Notice the difference in case with V and v is ignored
$ !6190:p
vi Variables/user-extensions.js
$ ["up-arrow"]
$ vi Variables/user-extensions.[now change .js to .html]
I also define hga
("History Grep All") to search my entire history:
$ alias hga
alias hga='history | grep -i'
but I don't use it much because my history is (intentionally) very large and I get too much output that later affects scrolling back thru pages in my terminal.