3 ms·
A sometimes handy addition to the s modifier is g, which replaces all instances of the pattern instead of just the first. $ echo "foo foo" foo foo
by sciurus 14y ago
A sometimes handy addition to the s modifier is g, which replaces all instances of the pattern instead of just the first.
$ echo "foo foo"
foo foo
$ echo !!:s/foo/bar
echo echo "bar foo"
echo bar foo
$ echo "foo foo"
foo foo
$ echo !!:gs/foo/bar
echo echo "bar bar"
echo bar bar