Linux - SoftwareThis forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
I would like to search for a string in all the files situated in two different directories. What is the best way to do so?
it works fine for one file with "less file | grep string" but I don`t know how to produce output of less recursively. Is there some other way to do the job?
You've tripped into the trap of thinking the less command needs to do something recursively! It's grep that needs to do this recursively, surely:
grep -re string > outfile.txt
-e is for a regular expression. -r is recursively. If you want to do this for HTML tags, have a look at regexlib on google. I've seen some tools in Perl for this purpose. Even wrote one myself once!
You're welcome.
Wenn ich die Wahl haette, wuerde ich immer Linux fuer dieser Art Probleme benutzen, weil man kann dass nicht mit Windows machen. Man hat Perl mit Linux oder wass - VisualStudio.NET ? Dass ist ein(en?) Witz!!
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.