mirror of
https://github.com/tldr-pages/tldr.git
synced 2025-08-04 09:35:33 +02:00
sed: fix faulty example and add remove line from file osx (#4781)
This commit is contained in:
parent
ca7388b08f
commit
b9e393f602
1 changed files with 6 additions and 2 deletions
|
@ -10,9 +10,9 @@
|
|||
|
||||
`sed -E 's/{{regex}}/{{replace}}/g' {{filename}}`
|
||||
|
||||
- Replace all occurrences of a string in a file, overwriting the file (i.e. in-place):
|
||||
- Replace all occurrences of a string [i]n a file, overwriting the file (i.e. in-place):
|
||||
|
||||
`sed --in-place='' 's/{{find}}/{{replace}}/g' {{filename}}`
|
||||
`sed -i '' 's/{{find}}/{{replace}}/g' {{filename}}`
|
||||
|
||||
- Replace only on lines matching the line pattern:
|
||||
|
||||
|
@ -29,3 +29,7 @@
|
|||
- Replace separator / by any other character not used in the find or replace patterns, e.g., #:
|
||||
|
||||
`sed 's#{{find}}#{{replace}}#' {{filename}}`
|
||||
|
||||
- [d]elete the line at the specific line number [i]n a file, overwriting the file:
|
||||
|
||||
`sed -i '' '{{line_number}}d' {{filename}}`
|
||||
|
|
Loading…
Add table
Reference in a new issue