Search and Mark lines for word matches from a CSV file

General questions about using TextPad

Moderators: AmigoJack, bbadmin, helios, Bob Hansen, MudGuard

Post Reply
sowsam
Posts: 1
Joined: Wed Jun 18, 2008 8:11 pm

Search and Mark lines for word matches from a CSV file

Post by sowsam »

Hello Textpad users,

I have a text file and I have a CSV file.

I want to mark all lines in the text file with search matches from the CSV file.

Example:
text file has
ABC
BCD
ABC
ABC
EEF

CSV file has
ABC,EEF

Looking for marking off lines 1,3,4,5

Can I do this in textpad using regex or any other means?

Thanks!
- Sowmya
webwiz
Posts: 6
Joined: Thu Jul 27, 2006 7:39 pm
Location: Oakland, California
Contact:

Re: Search and Mark lines for word matches from a CSV file

Post by webwiz »

How big is your CSV file? If it's a one-liner, you could use search-and-replace the commas to convert it to a regex, then use that to mark all lines in the target file.

If you want to match whole words, then convert the commas to "\>)|(\<" and add the start and end bits manually. Your result should look something like this to use as a search expression:

(\<ABC\>)|(\<EEF\>)

... where the "\<" and "\>" denote start and end of a word.

This uses POSIX notation. Choose from Preferences > Editor. You'll need a few more back-slashes if you don't.

Hope this helps.
Cordially, David
--
"Eschew obfuscation"
Post Reply