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?

0

1 Answer 1

3

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

!!:gs/5742/2839/

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.