Copy or delete macro

General questions about using TextPad

Moderators: AmigoJack, bbadmin, helios, MudGuard

Post Reply
zscw1
Posts: 1
Joined: Mon Feb 02, 2009 5:41 pm

Copy or delete macro

Post by zscw1 »

I have a number of text files that average between 100k and 500k. Example text
<OTURN>DataId=3001559&Version=1</OTURN>
<OTSubType>749</OTSubType>
<OTLocation>1539739 2952416 3001559 </OTLocation>
<OTCurrentVersion>TRUE</OTCurrentVersion>
<OTEmailSubject>CIS: watch-process suspect process issues</OTEmailSubject>

the above will repeat but listing different " DataId=###### "

What I'm trying to do is either delete everything except the DataId values or copy the DataId values to a new file. In either case the values seperated by a comma.

Can I do this with a macro ?
....Scott
ben_josephs
Posts: 2464
Joined: Sun Mar 02, 2003 9:22 pm

Post by ben_josephs »

Mark all the lines containing DataId= :
Search | Find... (<F5>):
Find what: DataId=

Mark All
Copy all the marked lines:
Edit | Copy Other | Bookmarked Lines

Paste them into another document.

In the other document:
Search | Replace... (<F8>):
Find what: .*DataId=([0-9]+).*\n
Replace with: \1,

[X] Regular expression

Replace All
This assumes you are using Posix regular expression syntax:
Configure | Preferences | Editor

[X] Use POSIX regular expression syntax
Post Reply