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.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Not what I need, this replace "*" with DEFINE.
find . -type f -name "*.cpp" -exec grep "DEFINE" {} +
Example
I need to find "#DEFINE MISO *" in header files.
Please - no references to RTFM necessary , I asked for help in forum .
I am perfectly capable to read and "try this ... try that".
I am asking for actual solution, if possible.
I understand there are different ways to do this , but I wanted HELP on "find" and "grep".
Note:
the ( ) grouping is needed because the default AND between find options has precedence over the -o OR.
The \( \) or "(" ")" escapes are needed to prevent the shell's interference.
History:
early GNU find had only -exec ... {} \;
that was much slower than -print0 | xargs -0 ...
with programs that take multiple arguments.
The -exec ... {} + comes from the Posix standard, works like the xargs, and should be even faster.
Sorry but I don't understand your need. First you wrote your initial post in such a way we thought you were searching for pattern "FAILED"... and now you seem to search for "#DEFINE MISO"...
It is, however, a working answer to what you initially wrote. If you define your task a solution can be provides ALONG WITH where to read up on it so you are able to advance rather than passively receive ready-made recipes. If you want the latter then there are other forums where you may negotiate a price first.
Anyway, MadeInGermany has provided you with a modified solution in post #10. If it is not what you are looking for then please be more specific in the details of your problem and its scope.
It is, however, a working answer to what you initially wrote. If you define your task a solution can be provides ALONG WITH where to read up on it so you are able to advance rather than passively receive ready-made recipes. If you want the latter then there are other forums where you may negotiate a price first.
Anyway, MadeInGermany has provided you with a modified solution in post #10. If it is not what you are looking for then please be more specific in the details of your problem and its scope.
You will see that either \b or \< and \> can be used to match the end (or start) of a word.
grep actually has a '-w' switch for that.
but i don't want that stupid cigar anyhow.
this thread is a fine example of how some people mistreat anyone who doesn't provide a spelled out perfect solution to a problem they haven't even defined properly.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.