ATTENTION: You are viewing a page formatted for mobile devices; to view the full web page, click HERE.

Main Area and Open Discussion > General Software Discussion

multi string search in file

(1/2) > >>

Blue4ce:
hi,

I have a list(1)

aaaa
bbbb
cccc
dddd
eeee
ffffff
eeee
bbbb

and I would like to search for list(2)

aaaa
eeee
xxxx

in list(1)

Is there any gui tool / text editor which can,
1) accept infile for "find what" or multiple lines of input in "find what"
2) highlight found items in the text, corresponding to any line of the "find what" patterns

I want to see something like this.

aaaa
bbbb
cccc
dddd
eeee
ffffff
eeee
bbbb

Hope I am clear enough .  :)

I dont want to format my "find what" strings into regular expressions, every time I do such a search.

Thanks.

rjbull:
Freeware - WanyWord.

If you're prepared to spend money - HFFR Text Workbench.  It's meant for search and replace, but you can use it in search-only mode.  I haven't looked at the cheaper editions.

Not sure either of them will present the results in exactly the format you suggest, but both will search for multiple strings.  You can still find the last free version of HFFR around the Net, but it doesn't match your criterion because it will only search for a single string.

housetier:
if I understood the man page correctly this will work partially:


--- ---grep --color=auto -f needle haystack where needle is your second list (the stuff to look FOR) and haystack is your first list (the stuff to look IN)

like sohousetier@reliant:/tmp$ cat haystack
aaaa
bbbb
cccc
dddd
eeee
ffffff
eeee
bbbb
housetier@reliant:/tmp$ cat needle
aaaa
eeee
xxxx
housetier@reliant:/tmp$ grep -f needle haystack
aaaa
eeee
eeee
housetier@reliant:/tmp$



After asking for help in the #c-base channel on freenode, we came up with this:

--- ---grep --color=auto -C $(wc -l < haystack) -f needle haystack

which looks like sohousetier@reliant:/tmp$ grep -C $(wc -l < haystack) -f needle haystack
aaaa
bbbb
cccc
dddd
eeee
ffffff
eeee
bbbb


This solution is completely free ;)

fiddyschmitt:
you could try hound (freeware) which is a program I wrote. [moderator removed bad link]

cheers,
Fidel

mouser:
Hey fidel! Welcome to the site! Always really fun to have another coder drop by and hang out.  Hope you will make yourself at home.

Navigation

[0] Message Index

[#] Next page

Go to full version