Find subject, extract X characters before and Y characters after

Get help with installation and running here.

Moderators: DataMystic Support, Moderators, DataMystic Support, Moderators, DataMystic Support, Moderators

Post Reply
apportum
Posts: 7
Joined: Thu Aug 20, 2009 5:00 pm

Find subject, extract X characters before and Y characters after

Post by apportum »

I want to search a 200+ GB file for specific targets (i.e., "jsmith@zmail.com").

When a target is found, I want to extract X characters before the target and Y characters after.

Thus the results might look something like ("abcd" . . . [80 characters] . . . jsmith@zmail.com . . . [750 characters] . . . "wxyz").

Is this possible in TextPipe v9.9.

Jerry
User avatar
DataMystic Support
Site Admin
Posts: 2227
Joined: Mon Jun 30, 2003 12:32 pm
Location: Melbourne, Australia
Contact:

Re: Find subject, extract X characters before and Y characters after

Post by DataMystic Support »

Hi Jerry,

Yes, absolutely. The simplest way to do this is with an EasyPattern search/replace:

Code: Select all

[40 characters]jsmith@zmail.com[40 characters]
Replace with:

Code: Select all

$0\r\n
And turn extract matches on - this discards non-matching text.

This outputs each match on a line of its own.

Do you need to know the line number? If so, an Extract Matches filter can be better, as it includes the line number and can also include lines of context before and after.
Post Reply