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
Search and Mark lines for word matches from a CSV file
Moderators: AmigoJack, bbadmin, helios, Bob Hansen, MudGuard
Re: Search and Mark lines for word matches from a CSV file
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.
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"
--
"Eschew obfuscation"