mirror of https://github.com/CrimsonTome/tldr.git
sed: show usage of a print command (#2154)
parent
5ef55e6fc4
commit
10ae4c7573
|
@ -1,6 +1,6 @@
|
|||
# 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:
|
||||
|
||||
|
@ -18,6 +18,10 @@
|
|||
|
||||
`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:
|
||||
|
||||
`sed -e 's/{{find}}/{{replace}}/' -e 's/{{find}}/{{replace}}/' {{filename}}`
|
||||
|
|
Loading…
Reference in New Issue