mirror of
https://github.com/tldr-pages/tldr.git
synced 2025-04-29 23:24:55 +02:00
Add doc for sed(1)
This commit is contained in:
parent
b7040ec87a
commit
989985bd4d
1 changed files with 16 additions and 0 deletions
16
osx/sed.md
Normal file
16
osx/sed.md
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
# sed
|
||||||
|
|
||||||
|
> Run replacements based on regular expressions
|
||||||
|
|
||||||
|
- replace all occurrences of a string in a file, and print the result
|
||||||
|
|
||||||
|
`sed 's/{{find}}/{{replace}}/g' {{filename}}`
|
||||||
|
|
||||||
|
- replace all occurrences of a string in a file, and overwrite the file
|
||||||
|
contents
|
||||||
|
|
||||||
|
`sed -i '' 's/{{find}}/{{replace}}/g' {{filename}}`
|
||||||
|
|
||||||
|
- replace all occurrences of an extended regular expression in a file
|
||||||
|
|
||||||
|
`sed -E 's/{{regex}}/{{replace}}/g' {{filename}}`
|
Loading…
Add table
Reference in a new issue