Doug Lerner
Doug Lerner

Reputation: 1543

In BBEdit, how can I search for a pattern and then copy all the lines found with that pattern?

In BBEdit (11.6.9), using find with grep checked on I'm looking for lines in a large file containing this pattern:

registeredTd="11/\d\d/2017

It stands for a registered date of November, 2017 in my file.

If I "find all" I get correctly see 69 occurrences of the pattern in the file i the results window.

But how, then, can I copy those found lines?

I can copy the results of the results window itself, but that copy (1) contains extra junk at the beginning and most importantly (2) does not contain the complete line. The lines in the result window are truncated.

Is there a way of copying all the complete lines containing the pattern?

Thanks,

doug

Upvotes: 3

Views: 3380

Answers (2)

Furia
Furia

Reputation: 1

Another option is to use the button "Extract" on the Find window. It will create a new file with the contents of the replace text. If you want to copy all the text of the find, put it into parenthesis and use \1 in the replace.

Upvotes: 0

Doug Lerner
Doug Lerner

Reputation: 1543

For what it's worth, the answer to this was to use the Text > Process Lines Containing... menu. There you can enter the same registeredTd="11/\d\d/2017 search parameter, and there is a checkbox option to copy the lines with the search results. It works perfectly.

Upvotes: 6

Related Questions