diff --git a/pages/common/sed.md b/pages/common/sed.md index b4054c9a7..51b1dcc22 100644 --- a/pages/common/sed.md +++ b/pages/common/sed.md @@ -6,6 +6,10 @@ `sed 's/{{find}}/{{replace}}/' {{filename}}` +- Replace only on lines matching the line pattern: + +`sed '/{{line_pattern}}/s/{{find}}/{{replace}}/'` + - Replace all occurrences of a string in a file, overwriting the file (i.e. in-place): `sed -i 's/{{find}}/{{replace}}/g' {{filename}}`