1
0
Fork 0
mirror of https://github.com/tldr-pages/tldr.git synced 2025-08-04 14:55:56 +02:00

sed: fix faulty example and add remove line from file osx (#4781)

This commit is contained in:
Stefan Wessels Beljaars 2020-10-24 16:10:25 +02:00 committed by GitHub
parent ca7388b08f
commit b9e393f602
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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}}`