On 02/11/2019, at 10:23, 'David J' via BBEdit Talk <[email protected] 
<mailto:[email protected]>> wrote:
> I’d like to search multiple text files for a keyword, copy those lines along 
> with the previous and next lines around that keyword line. Then output these 
> lines to a new file. Been trying to figure this one out for hours now, can 
> someone show me the way? 


Hey David,

Multiple text files?

Where?

Clustered together?

If so then `grep` from the command line works very well and very fast.


egrep -A1 -B1 '03' *.txt | bbedit


egrep    -->  Grep with Extended Regular Expressions.
-A       -->  Means # of lines After.
-B       -->  Means # of lines Before.
'03'     -->  Literal text in this case but can be a regex.
*.txt    -->  Filtering to text files only, but could be *.html or even just * 
for all files.
| bbedit -->  Pipe to BBEdit

--
Best Regards,
Chris

-- 
This is the BBEdit Talk public discussion group. If you have a 
feature request or need technical support, please email
"[email protected]" rather than posting to the group.
Follow @bbedit on Twitter: <https://www.twitter.com/bbedit>
--- 
You received this message because you are subscribed to the Google Groups 
"BBEdit Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/bbedit.

Reply via email to