remove n lines before and after a specific text
-
Hi to all,
I am not at all an expert in notepad ++ and above all in commands to find and replace words or phrases within a text. I would like to be able to delete, on several files, some lines before and after a line that contains a specific word (but leaving everything else before and after) . Example:text bla bla bla
bla bla bla
<actor>
<name> Chuck Profus </name>
<role> Drums </role>
<order> 5 </order>
<thumb></thumb>
</actor>
bla bla bla
bla bla blaI’d like to delete 4 lines before and 1 after <thumb></thumb>
and must become in all the files:text bla bla bla
bla bla bla
<thumb></thumb>
bla bla bla
bla bla blaIt can be done? Thanks in advance
-
You might try:
Find:
(?-s)(?:.*?\R){4}^(.*?<thumb></thumb>.*?\R).*?\R
Repl:${1}
Search mode: Regular expression -
@Alan-Kilborn said in remove n lines before and after a specific text:
${1}
seems that it works!!! many thanks!
now I try on multiple files
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login