Sample Header Ad - 728x90

to search for files with 2 (full or partial) keywords content (txt files) in a folder and sub folder and files with specific filename

2 votes
1 answer
217 views
I just want to share this, and hoping will get more similar tool. I got a directory of text files.. i need to search for the files with 2 (partial) words in it.. the keywords are in random order, but on a same line. So far, i can use this: $ rg -i '\w*keyword1\w*.*\w*keyword2\w*|\w*keyword2\w*.*\w*keyword1\w*' --glob '*.txt' --line-number -l /path/to/search $ rg -g '*.txt' -l -i 'keyword1.*keyword2|keyword2.*keyword1' /path/to/search Both of these can do the same job. Anybody have other that can do the same job ? Pls do share. I found myself need this quite often to locate the proper file.. However i don't know how to search file that filename is 2 keywords that are not in order. How about searching for filename with 2 keyword that is not in order ? Example: weirdfilename_key1Nkey3Nkey2etc.txt search among huge database for file with which name only remember consist of "key2" and "key3" in it, but not sure the order..
Asked by andrew_ysk (155 rep)
Apr 9, 2023, 11:00 PM
Last activity: Apr 10, 2023, 07:14 AM