mirror of
https://github.com/cheat/cheat.git
synced 2025-09-06 12:03:00 +02:00
Added insert/add line examples
Added insert/add line examples.
This commit is contained in:
@ -15,3 +15,9 @@ sed '/^$/d' file.txt
|
|||||||
|
|
||||||
# To replace newlines in multiple lines
|
# To replace newlines in multiple lines
|
||||||
sed ':a;N;$!ba;s/\n//g' file.txt
|
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.'
|
||||||
|
Reference in New Issue
Block a user