4 ms·
And if you only have a single instance to replace, you can use ^old^new^ $ echo "hello hello hello world" hello hello hello world $ ^hello^bonjour^ echo "bonjo
by tikkabhuna 6y ago
And if you only have a single instance to replace, you can use ^old^new^
$ echo "hello hello hello world"
hello hello hello world
$ ^hello^bonjour^
echo "bonjour hello hello world"
bonjour hello hello world
- alex_smart 6y agoI know that this expansion exists, but never use it in practice. Why? The last command is more general, you can just drop the g from the command I wrote to only replace the first occurrence. Besides, :[g]s/old/new should already be familiar to anyone who has used vim, so that is almost like having to learn zero new things.
- dcassett 6y agoThis is great for removing an option from a prior command such as unzip -t ...: ^-t