Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What text editor support extraction of found results into another file?

Usually I have the following situation: There is a PONO class with list of the 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 are tool, preferably Notepad++ or VS plugin, to extract the regex output into another file?

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

UserName
Password
Email
Title

in a new file.

like image 992
ikutsin Avatar asked Feb 24 '23 18:02

ikutsin


2 Answers

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

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

From v5.8.7 changelog:

  • In order to reduce the confusion, new "Mark" tab for "Mark all" feature is made in Find/Replace dialog.

I guess that the Bookmark line checkbox and Mark all are placed in another tab in v5.8.6.

like image 147
alexandrul Avatar answered Feb 27 '23 07:02

alexandrul


Not a text editor solution, but

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

should work. Untested.

like image 30
alternative Avatar answered Feb 27 '23 08:02

alternative