Skip to main content
  1. Blog/

Deleting lines with nushell

·83 words·1 min

When working with a lot of text it is oftentimes useful to be able to edit fast, including being able to remove whole lines starting with, containing er ending with specific words.

In nushell this can be done in various ways. Here are a few for lines starting with a specific word:

open --raw text.md
| lines
| find --regex "^word" --invert


open --raw text.md
| lines
| where $it !~ '^word'


open --raw text.md 
| lines 
| where not ($it starts-with 'word')