Added insert/add line examples

Added insert/add line examples.
This commit is contained in:
Erik Terpstra 2018-09-11 09:22:21 +02:00 committed by GitHub
parent feab7a9706
commit 2fcc808e63
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 0 deletions

View File

@ -15,3 +15,9 @@ sed '/^$/d' file.txt
# To replace newlines in multiple lines
sed ':a;N;$!ba;s/\n//g' file.txt
# Insert a line before a matching pattern:
sed '/Once upon a time/i\Chapter 1'
# Add a line after a matching pattern:
sed '/happily ever after/a\The end.'