Search This Blog

Friday, September 6, 2019

NOTEPAD ++ INFO

Removing duplicate rows in Notepad++

You will need the TextFX plugin. This used to be included in older versions of Notepad++, but if you have a newer version, you can add it from the menu by going to Plugins -> Plugin Manager -> Show Plugin Manager -> Available tab -> TextFX -> Install. In some cases it may also be called TextFX Characters, but this is the same thing
The check boxes and buttons required will now appear in the menu under: TextFX -> TextFX Tools.
Make sure "sort outputs only unique..." is checked. Next, select a block of text (Ctrl+A to select the entire document). Finally, click "sort lines case sensitive" or "sort lines case insensitive"
menu layout in n++

Since Notepad++ Version 6 you can use this regex in the search and replace dialogue:
^(.*?)$\s+?^(?=.*^\1$)
and replace with nothing. This leaves from all duplicate rows the last occurrence in the file.
No sorting is needed for that and the duplicate rows can be anywhere in the file!
You need to check the options "Regular expression" and ". matches newline":
Notepad++ Replace dialogue
  • ^ matches the start of the line.
  • (.*?) matches any characters 0 or more times, but as few as possible (It matches exactly on row, this is needed because of the ". matches newline" option). The matched row is stored, because of the brackets around and accessible using \1
  • $ matches the end of the line.
  • \s+?^ this part matches all whitespace characters (newlines!) till the start of the next row ==> This removes the newlines after the matchd row, so that no empty row is there after the replacement.
  • (?=.*^\1$) this is a positive lookahead assertion. This is the important part in this regex, a row is only matched (and removed), when there is exactly the same row following somewhere else in the file.
OR

if the rows are immediately after each other then you can use a regex replace
Search Pattern: ^(.*\r?\n)(\1)+
Replace with: \1
OR
Notepad++
-> Replace window
Ensure that in Search Mode
you have selected Regular expression radio button
Find what:
^(.*)(\r?\n\1)+$
Replace with:
$1
before:
and we think there
and we think there
single line
Is it possible to
Is it possible to
after:
and we think there
single line
Is it possible to

Delete all lines in Notepad++ except lines containing a word

There is an easy way to achieve this. You need to perform 3 steps.
  1. Go to Search menu > Find... > Select "Mark" Tab. Activate regular expressions. Search for ^<Path> (^ is for line start). Don't forget to check "Bookmark lines" and Press "Mark All"
    ==> All Rows you want to keep got a Bookmark
  2. Go to Menu "Search - Bookmark - Inverse Bookmark"
    ==> All Line you want to delete are bookmarked.
  3. Go to Menu "Search - Bookmark - Remove Bookmarked lines"
    ==> All Bookmarked lines are deleted.

How can I delete rest of the line after a specific string?

Before
 *://81.88.22.6/*=UUID:63969B2469B7A94EBBDBD7CB5B9C00BA
Search mode regular expression, Find
=UUID:.*
Replace with nothing.
OR
My answer:
[=].*




Add To Google BookmarksStumble ThisFav This With TechnoratiAdd To Del.icio.usDigg ThisAdd To RedditTwit ThisAdd To FacebookAdd To Yahoo

0 comments:

Post a Comment