G'day
How about using vi mode? Just type set -o vi
Then you can go to the word you want to change and just make cw or cW depending on what is in the word?
Oh, I forgot to add that you enter ESC k to o in the previous line in the command history.
What do you usually use for the editor?
amuses Rob
Edit: I forgot to say in my original answer that you need to think about the vi command line in bash using the commands you enter when you are in ex mode in vi, i.e. after you entered the colon.
The worst part is that you need to navigate through the history of commands using the ancient commands vi h (left) and l (right). You can use w (or W) to bounce through words.
Once you get used to it, you will get all kinds of commands, for example. entering ESC / my_command will look back through your history, first of all, first to find the first appearance of the command line containing the text my_command. Once it detects this, you can use n to search for the next event, etc. And N to change the direction of the search.
I would try reading the bash man page to find out what is available in vi mode. Once you get to the point where the up arrow and down arrow will be replaced by ESC k and then j, you will see that vi mode offers more than emacs mode for editing command line in bash.
IMHO natchurly! (-:
Emacs Eighty megabytes and a permanent replacement!
amuses Rob
source share