From 93690e072355909a8e1a77dbd2fc3a40f24b54c2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miroslav=20C=CC=8Cech?= Date: Tue, 14 Aug 2018 11:39:22 +0200 Subject: [PATCH] sed: introduce print command in osx --- pages/osx/sed.md | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/pages/osx/sed.md b/pages/osx/sed.md index 5778dc2c90..8e8be1b307 100644 --- a/pages/osx/sed.md +++ b/pages/osx/sed.md @@ -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}}`