diff options
-rw-r--r-- | src/tools/sed.md | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/tools/sed.md b/src/tools/sed.md index 1746c24..1bd8185 100644 --- a/src/tools/sed.md +++ b/src/tools/sed.md @@ -30,6 +30,16 @@ echo -e 'aa\nbb\ncc\ndd' | sed '$d' # Delete range of lines. echo -e 'aa\nbb\ncc\ndd' | sed '1,3d' # dd + +# Delete lines matching pattern. +echo -e 'aa\nbb\ncc\ndd' | sed '/bb/d' +# aa +# cc +# dd + +# Delete lines NOT matching pattern. +echo -e 'aa\nbb\ncc\ndd' | sed '/bb/!d' +# bb ``` ### Insert lines |