Kate-Editor - How to remove lines containing a string?

I’ve got some lines containing the string:

DESCRIPTION [at the beginning of a line] and some more characters [to the end of this line] 

With the term DESCRIPTION.+ in the search mask there are 90 lines which include the term DESCRIPTION and they are being marked from start to end in the match field.
Now I want to remove all these lines and not replace it by other characters.

But what is the syntax, is there a special control character or regex for this ?

  1. Press Ctrl+R.
  2. Change the Mode from “Plain text” to “Regular expression”.
  3. In the “Find” field, put “^DESCRIPTION.*$” without the quotes.
  4. Leave the “Replace” field empty.
  5. Click “Replace All”.
  6. To remove the empty rows after, use “^\s*$” in a separate find and replace.
    • Alternatively, you can right-click in the document and click “Remove Empty Lines” under the “Editing” section if you don’t mind it removing ALL empty lines/rows.

Thanks, I tried that but this is only removes the content of the row but not the row itself !?
So I’ve got 60 empty rows now - the row has to die! :saluting_face:

Updated the steps. I think this may remove empty rows you don’t want removed as well. Not sure though.

Try “^DESCRIPTION.*\n” as your find expression. “It worked for me” ™

1 Like

At first I thought I tried that one before but I did that \n in the replace field wich didn’t work.

THANKS!