Many of you probably know that the commands ^foo^bar^ or !:gs/foo/bar are useful for running the previous command with replacing the pattern foo with the pattern bar.But is there a way to replace multiple pattern from the previous command, like for example in ls *.jpg | grep photo replacing the words jpg and photo without too complicated pattern matching like !:gs/jpg\(.*\)photo/png\1foto?
Run previous command with multiple replacements
bash;regular expression;command history