Help with Find + Multi-line copy


#1

Hello,

I’m exploring the use of Atom as a replacement for Notepad++ - I like what I’ve experienced with it so far. One particular feature set that I’ve been trying to find some similarity from N++ to Atom is a “Find / Copy line” function.

Every so often, I’ll be editing configuration files for systems/network gear and I need to edit certain swaths of text.

In N++, I’d typically:

-) Open the config file in N++
-) Run a Find for a certain portion of text
-) Bookmark all lines that were found that contained that portion of text
-) Copy all bookmarked lines
-) Paste all bookmarked lines into a new file

This way, I’d be able to just focus on editing those specific components of the config that I was interested in.

I understand that there may not be a 1:1 similar feature/function in Atom - are there any suggestions as to how to perform this kind of focused editing in Atom instead?

Thanks,

Tariq


#2

Hello.

Nice question!
The exact steps in Notepad++, would be interesting to see too.

Looking into what you are asking, I have found LINK

My suggestion on a Windows machine:
step 0 => Open your file…

  1. Trigger Atom’s built-in find-replace function by Ctrl+f on the “old” file.

  2. Fill out the search field as you require.
    :-P_…{Regular Expressions rules!}_

  3. Execute a Find All.

  4. Press Alt+Enter.
    !> This activates a cursor at each search result

  5. Press Home to go to the start of the line.

  6. Press Shift+End to select text up to the end of the line.

  7. Copy - Ctrl+c

  8. `Ctrl-n’ to create a new empty text editor.

  9. Paste - Ctrl+v

  10. DONE

Test case example… selecting the 8 in…

89099
54755
11556
34158
87687

Test case result:
image

So… does this work for you?
dP


#3

Awesome - worked like a charm :slight_smile:

Thanks


#4

I saw that you’d like to see what this would look like in Notepad++. I use a Mac but I have a Win10 VM with Notepad++ installed and was able to generate some screenshots.

Using the same sample set you listed:

Use Ctrl+F and click on the “Mark” tab. Once there, enter in the text to find, check off the “Bookmark” checkbox and then click the “Mark All” button

The lines containing the sought after text will appear with a blue circle next to them

Then you click on the “Search” menu, “Bookmark” and the option for “Copy Bookmarked Lines”

Once that’s done, Ctrl+N to start a new file and Ctrl+V to paste

Hope this helps.


#5

Hi.

“Copy bookmark lines” is the detail I missed. Yes, this does help.

WOW!!
Your generous help to my request was unexpected. Thank you very much for giving me such a detailed instruction!

Thank you for your time and your effort.

Well wishes until next time
Dan Padric