Replace all string matches from previous command in bash
Snippet
Written with a loving hand by kitt some time around 19:58 on 22 April 2016
$ !!:gs/replacethis/withthis/
gs = global replace
Works only with bash version 3 or greater:
bash-3.2$ bash --version GNU bash, version 3.2.57
$ echo oneone oneone $ !!:gs/one/two/ # Repeats last command; substitutes 'one' --> 'two'. twotwo
Add new comment