2

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?

1 Answers1

3

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

!!:gs/5742/2839/
fedorqui
  • 7,861
  • 7
  • 36
  • 74