Page 1 of 1

Copy or delete macro

Posted: Mon Feb 02, 2009 6:09 pm
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 ?

Posted: Mon Feb 02, 2009 8:32 pm
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