mirror of
https://github.com/tldr-pages/tldr.git
synced 2025-09-10 17:33:38 +02:00
Merge pull request #807 from tldr-pages/replace-on-matched-line
Sed: adds replace before matching sample
This commit is contained in:
commit
4e4d430223
1 changed files with 4 additions and 0 deletions
|
@ -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}}`
|
||||
|
|
Loading…
Add table
Reference in a new issue