Replacing strings in files based on certain search criteria is a very common task. How can I
- replace string
foowithbarin all files in the current directory? - do the same recursively for sub directories?
- replace only if the file name matches another string?
- replace only if the string is found in a certain context?
- replace if the string is on a certain line number?
- replace multiple strings with the same replacement
- replace multiple strings with different replacements