Search list of texts in files?












0















I'm looking for a search engine for lists of text strings in files. I do not use the programs that only look for a line because I need to search several text strings and that the program performs the search in all files with the extension .txt.



The list of text strings to search, is only for the program to search one by one in each of the files. Once the search is complete, the program should show those files that match one or more of a text string specified in the list.










share|improve this question




















  • 2





    You are looking for files which contains all desired strings or only some of them?

    – Ravexina
    12 hours ago













  • @Ravexina I updated the question in more detail. The files may contain only a few strings of the searched text.

    – MarianoM
    12 hours ago











  • Where are the files; in a folder (flat), in a directory (recursively) or set as args from cli?

    – Jacob Vlijm
    12 hours ago











  • @MarianoM Updated my answer ...

    – Ravexina
    12 hours ago











  • @JacobVlijm The files can be in recursive directories.

    – MarianoM
    12 hours ago
















0















I'm looking for a search engine for lists of text strings in files. I do not use the programs that only look for a line because I need to search several text strings and that the program performs the search in all files with the extension .txt.



The list of text strings to search, is only for the program to search one by one in each of the files. Once the search is complete, the program should show those files that match one or more of a text string specified in the list.










share|improve this question




















  • 2





    You are looking for files which contains all desired strings or only some of them?

    – Ravexina
    12 hours ago













  • @Ravexina I updated the question in more detail. The files may contain only a few strings of the searched text.

    – MarianoM
    12 hours ago











  • Where are the files; in a folder (flat), in a directory (recursively) or set as args from cli?

    – Jacob Vlijm
    12 hours ago











  • @MarianoM Updated my answer ...

    – Ravexina
    12 hours ago











  • @JacobVlijm The files can be in recursive directories.

    – MarianoM
    12 hours ago














0












0








0


1






I'm looking for a search engine for lists of text strings in files. I do not use the programs that only look for a line because I need to search several text strings and that the program performs the search in all files with the extension .txt.



The list of text strings to search, is only for the program to search one by one in each of the files. Once the search is complete, the program should show those files that match one or more of a text string specified in the list.










share|improve this question
















I'm looking for a search engine for lists of text strings in files. I do not use the programs that only look for a line because I need to search several text strings and that the program performs the search in all files with the extension .txt.



The list of text strings to search, is only for the program to search one by one in each of the files. Once the search is complete, the program should show those files that match one or more of a text string specified in the list.







search text






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited 12 hours ago







MarianoM

















asked 12 hours ago









MarianoMMarianoM

7010




7010








  • 2





    You are looking for files which contains all desired strings or only some of them?

    – Ravexina
    12 hours ago













  • @Ravexina I updated the question in more detail. The files may contain only a few strings of the searched text.

    – MarianoM
    12 hours ago











  • Where are the files; in a folder (flat), in a directory (recursively) or set as args from cli?

    – Jacob Vlijm
    12 hours ago











  • @MarianoM Updated my answer ...

    – Ravexina
    12 hours ago











  • @JacobVlijm The files can be in recursive directories.

    – MarianoM
    12 hours ago














  • 2





    You are looking for files which contains all desired strings or only some of them?

    – Ravexina
    12 hours ago













  • @Ravexina I updated the question in more detail. The files may contain only a few strings of the searched text.

    – MarianoM
    12 hours ago











  • Where are the files; in a folder (flat), in a directory (recursively) or set as args from cli?

    – Jacob Vlijm
    12 hours ago











  • @MarianoM Updated my answer ...

    – Ravexina
    12 hours ago











  • @JacobVlijm The files can be in recursive directories.

    – MarianoM
    12 hours ago








2




2





You are looking for files which contains all desired strings or only some of them?

– Ravexina
12 hours ago







You are looking for files which contains all desired strings or only some of them?

– Ravexina
12 hours ago















@Ravexina I updated the question in more detail. The files may contain only a few strings of the searched text.

– MarianoM
12 hours ago





@Ravexina I updated the question in more detail. The files may contain only a few strings of the searched text.

– MarianoM
12 hours ago













Where are the files; in a folder (flat), in a directory (recursively) or set as args from cli?

– Jacob Vlijm
12 hours ago





Where are the files; in a folder (flat), in a directory (recursively) or set as args from cli?

– Jacob Vlijm
12 hours ago













@MarianoM Updated my answer ...

– Ravexina
12 hours ago





@MarianoM Updated my answer ...

– Ravexina
12 hours ago













@JacobVlijm The files can be in recursive directories.

– MarianoM
12 hours ago





@JacobVlijm The files can be in recursive directories.

– MarianoM
12 hours ago










1 Answer
1






active

oldest

votes


















3














You can use grep in command line:



grep -Fl -f list *.txt


list is a file containing a list of strings you are looking for, and it will look for them in all .txt files where you have run the command.



or for searching recursively:



grep -Frl --include='*.txt' -f list .



-f Obtain patterns from FILE, one per line.






Here is an example, I've got three files: "1.txt" "2.txt" and "3.txt".



1.txt:



a
b
c


2.txt:



a
b
c
d


3.txt:



e
f
g


list file contains:



a
d


After running grep -Fl -f list *.txt what is get is:



1.txt
2.txt


-l for showing only the file names.
-f defines a file which contains the list of strings
-F Interpret PATTERN as a list of fixed strings (instead of regular expressions)






share|improve this answer


























  • I was doing some tests and it works as expected :) Thank you!

    – MarianoM
    12 hours ago











  • @MarianoM You're welcome ;)

    – Ravexina
    11 hours ago











Your Answer








StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "89"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1117140%2fsearch-list-of-texts-in-files%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









3














You can use grep in command line:



grep -Fl -f list *.txt


list is a file containing a list of strings you are looking for, and it will look for them in all .txt files where you have run the command.



or for searching recursively:



grep -Frl --include='*.txt' -f list .



-f Obtain patterns from FILE, one per line.






Here is an example, I've got three files: "1.txt" "2.txt" and "3.txt".



1.txt:



a
b
c


2.txt:



a
b
c
d


3.txt:



e
f
g


list file contains:



a
d


After running grep -Fl -f list *.txt what is get is:



1.txt
2.txt


-l for showing only the file names.
-f defines a file which contains the list of strings
-F Interpret PATTERN as a list of fixed strings (instead of regular expressions)






share|improve this answer


























  • I was doing some tests and it works as expected :) Thank you!

    – MarianoM
    12 hours ago











  • @MarianoM You're welcome ;)

    – Ravexina
    11 hours ago
















3














You can use grep in command line:



grep -Fl -f list *.txt


list is a file containing a list of strings you are looking for, and it will look for them in all .txt files where you have run the command.



or for searching recursively:



grep -Frl --include='*.txt' -f list .



-f Obtain patterns from FILE, one per line.






Here is an example, I've got three files: "1.txt" "2.txt" and "3.txt".



1.txt:



a
b
c


2.txt:



a
b
c
d


3.txt:



e
f
g


list file contains:



a
d


After running grep -Fl -f list *.txt what is get is:



1.txt
2.txt


-l for showing only the file names.
-f defines a file which contains the list of strings
-F Interpret PATTERN as a list of fixed strings (instead of regular expressions)






share|improve this answer


























  • I was doing some tests and it works as expected :) Thank you!

    – MarianoM
    12 hours ago











  • @MarianoM You're welcome ;)

    – Ravexina
    11 hours ago














3












3








3







You can use grep in command line:



grep -Fl -f list *.txt


list is a file containing a list of strings you are looking for, and it will look for them in all .txt files where you have run the command.



or for searching recursively:



grep -Frl --include='*.txt' -f list .



-f Obtain patterns from FILE, one per line.






Here is an example, I've got three files: "1.txt" "2.txt" and "3.txt".



1.txt:



a
b
c


2.txt:



a
b
c
d


3.txt:



e
f
g


list file contains:



a
d


After running grep -Fl -f list *.txt what is get is:



1.txt
2.txt


-l for showing only the file names.
-f defines a file which contains the list of strings
-F Interpret PATTERN as a list of fixed strings (instead of regular expressions)






share|improve this answer















You can use grep in command line:



grep -Fl -f list *.txt


list is a file containing a list of strings you are looking for, and it will look for them in all .txt files where you have run the command.



or for searching recursively:



grep -Frl --include='*.txt' -f list .



-f Obtain patterns from FILE, one per line.






Here is an example, I've got three files: "1.txt" "2.txt" and "3.txt".



1.txt:



a
b
c


2.txt:



a
b
c
d


3.txt:



e
f
g


list file contains:



a
d


After running grep -Fl -f list *.txt what is get is:



1.txt
2.txt


-l for showing only the file names.
-f defines a file which contains the list of strings
-F Interpret PATTERN as a list of fixed strings (instead of regular expressions)







share|improve this answer














share|improve this answer



share|improve this answer








edited 11 hours ago

























answered 12 hours ago









RavexinaRavexina

32.3k1483113




32.3k1483113













  • I was doing some tests and it works as expected :) Thank you!

    – MarianoM
    12 hours ago











  • @MarianoM You're welcome ;)

    – Ravexina
    11 hours ago



















  • I was doing some tests and it works as expected :) Thank you!

    – MarianoM
    12 hours ago











  • @MarianoM You're welcome ;)

    – Ravexina
    11 hours ago

















I was doing some tests and it works as expected :) Thank you!

– MarianoM
12 hours ago





I was doing some tests and it works as expected :) Thank you!

– MarianoM
12 hours ago













@MarianoM You're welcome ;)

– Ravexina
11 hours ago





@MarianoM You're welcome ;)

– Ravexina
11 hours ago


















draft saved

draft discarded




















































Thanks for contributing an answer to Ask Ubuntu!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1117140%2fsearch-list-of-texts-in-files%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Category:香港粉麵

List *all* the tuples!

Channel [V]