mirror of
https://github.com/tldr-pages/tldr.git
synced 2025-08-05 05:55:33 +02:00
sed: introduce print command in osx
This commit is contained in:
parent
23908705cf
commit
93690e0723
1 changed files with 5 additions and 1 deletions
|
@ -1,6 +1,6 @@
|
||||||
# sed
|
# sed
|
||||||
|
|
||||||
> Run replacements based on regular expressions.
|
> Edit text in a scriptable manner.
|
||||||
|
|
||||||
- Replace the first occurrence of a string in a file, and print the result:
|
- Replace the first occurrence of a string in a file, and print the result:
|
||||||
|
|
||||||
|
@ -18,6 +18,10 @@
|
||||||
|
|
||||||
`sed '/{{line_pattern}}/s/{{find}}/{{replace}}/' {{filename}}`
|
`sed '/{{line_pattern}}/s/{{find}}/{{replace}}/' {{filename}}`
|
||||||
|
|
||||||
|
- Print only text between n-th line till the next empty line:
|
||||||
|
|
||||||
|
`sed -n '{{line_number}},/^$/p' {{filename}}`
|
||||||
|
|
||||||
- Apply multiple find-replace expressions to a file:
|
- Apply multiple find-replace expressions to a file:
|
||||||
|
|
||||||
`sed -e 's/{{find}}/{{replace}}/' -e 's/{{find}}/{{replace}}/' {{filename}}`
|
`sed -e 's/{{find}}/{{replace}}/' -e 's/{{find}}/{{replace}}/' {{filename}}`
|
||||||
|
|
Loading…
Add table
Reference in a new issue