Which text editor supports extracting found results to another file?

Usually I have the following situation: There is a PONO class with a list of properties.

public string UserName { get { return this.userName; } set { if (this.userName != value) { SetDirty(); this.userName = value; } } } public string Password { get { return this.password; } set { if (this.password != value) { SetDirty(); this.password = value; } } } public string Email { get { return this.email; } set { if (this.email != value) { SetDirty(); this.email = value; } } } public string Title { get { return this.title; } set { if (this.title != value) { SetDirty(); this.title = value; } } } 

Is there a tool, preferably Notepad ++ or VS-plugin, for outputting regular expression output to another file?

For example: Find: "public string (. *) $" Results:

 UserName Password Email Title 

in the new file.

+4
source share
2 answers

In Notepad ++, use the Search / Find dialog and in the Mark tab, select the Bookmark line check box - after Mark all , you will have bookmarks on all the desired lines. enter image description here

The last step is Search / Bookmark / Copy bookmarked lines and paste them into a new file, where you can delete the public string part.

From v.5.8.7 change log:

  • To reduce confusion, a new Mark tab has been added for the Mark All function in the Find / Replace dialog box.

I believe that the Bookmark line and Mark all checkboxes are located on a different tab in version 5.6.6.

+7
source

Not a text editor solution, but

grep "public string .+$" < file | sed "s/public string (.+)$/\1/" > out

must work. Unverified.

+1
source

Source: https://habr.com/ru/post/1344248/


All Articles