Search list of texts in files?





.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ margin-bottom:0;
}







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
    Feb 10 at 13:52













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

    – MarianoM
    Feb 10 at 13:56











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

    – Jacob Vlijm
    Feb 10 at 13:57











  • @MarianoM Updated my answer ...

    – Ravexina
    Feb 10 at 14:02











  • @JacobVlijm The files can be in recursive directories.

    – MarianoM
    Feb 10 at 14:03


















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
    Feb 10 at 13:52













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

    – MarianoM
    Feb 10 at 13:56











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

    – Jacob Vlijm
    Feb 10 at 13:57











  • @MarianoM Updated my answer ...

    – Ravexina
    Feb 10 at 14:02











  • @JacobVlijm The files can be in recursive directories.

    – MarianoM
    Feb 10 at 14:03














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 Feb 10 at 13:53







MarianoM

















asked Feb 10 at 13:47









MarianoMMarianoM

7510




7510








  • 2





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

    – Ravexina
    Feb 10 at 13:52













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

    – MarianoM
    Feb 10 at 13:56











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

    – Jacob Vlijm
    Feb 10 at 13:57











  • @MarianoM Updated my answer ...

    – Ravexina
    Feb 10 at 14:02











  • @JacobVlijm The files can be in recursive directories.

    – MarianoM
    Feb 10 at 14:03














  • 2





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

    – Ravexina
    Feb 10 at 13:52













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

    – MarianoM
    Feb 10 at 13:56











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

    – Jacob Vlijm
    Feb 10 at 13:57











  • @MarianoM Updated my answer ...

    – Ravexina
    Feb 10 at 14:02











  • @JacobVlijm The files can be in recursive directories.

    – MarianoM
    Feb 10 at 14:03








2




2





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

– Ravexina
Feb 10 at 13:52







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

– Ravexina
Feb 10 at 13:52















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

– MarianoM
Feb 10 at 13:56





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

– MarianoM
Feb 10 at 13:56













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

– Jacob Vlijm
Feb 10 at 13:57





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

– Jacob Vlijm
Feb 10 at 13:57













@MarianoM Updated my answer ...

– Ravexina
Feb 10 at 14:02





@MarianoM Updated my answer ...

– Ravexina
Feb 10 at 14:02













@JacobVlijm The files can be in recursive directories.

– MarianoM
Feb 10 at 14:03





@JacobVlijm The files can be in recursive directories.

– MarianoM
Feb 10 at 14:03










1 Answer
1






active

oldest

votes


















4














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
    Feb 10 at 14:19











  • @MarianoM You're welcome ;)

    – Ravexina
    Feb 10 at 14:31












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









4














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
    Feb 10 at 14:19











  • @MarianoM You're welcome ;)

    – Ravexina
    Feb 10 at 14:31
















4














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
    Feb 10 at 14:19











  • @MarianoM You're welcome ;)

    – Ravexina
    Feb 10 at 14:31














4












4








4







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 Feb 10 at 14:30

























answered Feb 10 at 13:50









RavexinaRavexina

33.5k1489118




33.5k1489118













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

    – MarianoM
    Feb 10 at 14:19











  • @MarianoM You're welcome ;)

    – Ravexina
    Feb 10 at 14:31



















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

    – MarianoM
    Feb 10 at 14:19











  • @MarianoM You're welcome ;)

    – Ravexina
    Feb 10 at 14:31

















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

– MarianoM
Feb 10 at 14:19





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

– MarianoM
Feb 10 at 14:19













@MarianoM You're welcome ;)

– Ravexina
Feb 10 at 14:31





@MarianoM You're welcome ;)

– Ravexina
Feb 10 at 14:31


















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

Human spaceflight

Can not write log (Is /dev/pts mounted?) - openpty in Ubuntu-on-Windows?

File:DeusFollowingSea.jpg