This question already has an answer here:

I know I can replace a string of the previous command using ^old^new. But it seems to only replace the first occurrences as I do the follow:

$ cat /proc/5742/task/5742/status
$ ^5742^2839
cat /proc/2839/task/5742/status
cat: /proc/2839/task/5742/status: No such file or director

How to replace all occurrences, if possible?

marked as duplicate by jasonwryan, Graeme, slm, vonbrand, casey Mar 18 '14 at 3:07

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.


As ^old^new corresponds to !!:s/old/new, you can use the following to make a global replacement:


Not the answer you're looking for? Browse other questions tagged or ask your own question.