Macro/Method to copy lines with keyword to a new file

General questions about using TextPad

Moderators: AmigoJack, bbadmin, helios, MudGuard

Post Reply
prasadar78
Posts: 1
Joined: Mon Aug 03, 2009 10:02 am

Macro/Method to copy lines with keyword to a new file

Post by prasadar78 »

Hi,

I need copy lines with a specific key word from one file into a new file.

From the below lines

version = {
project = ""
library = ""
item_passport = "aae94f37-48ad-11db-8a06-001143772852"
version_passport = "96091540-6041-11db-b80a-00123f756de7"
type = "LIB PART"
intent = "reference"
version_number = 3
filename = "1854106C_0107.prt"
name = "PIN_THERMOSTAT JIGGLE"
part_number = "N_104618"
revision = "-"
created = {
on = "20-Oct-2006 08:47:53.00"
}

i need to copy the text from lines having the key work item_passport and version_passport into a new text file.
For Eg: from the above example i need to copy

item_passport = "aae94f37-48ad-11db-8a06-001143772852"
version_passport = "96091540-6041-11db-b80a-00123f756de7"

Any help will be appreciated. Right now i am doing it manually and is a night mare.
ben_josephs
Posts: 2464
Joined: Sun Mar 02, 2003 9:22 pm

Post by ben_josephs »

Mark all the lines containing item_passport or version_passport:

Search | Find... (<F5>):
Find what: item_passport|version_passport

[X] Regular expression

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

[X] Use POSIX regular expression syntax
Copy all the marked lines:
Edit | Copy Other | Bookmarked Lines

Paste them into the other document.
Post Reply