Let's suppose I want to find all .txt files and search for some string. I would do:
find ./ -type f -name "*.txt" -exec egrep -iH 'something' '{}' \;
What if I want to do a more complex filtering, like this:
egrep something file.txt | egrep somethingelse | egrep other
Inside find -exec? (or similar)
Please keep in mind that I'm searching for a solution that I could easily type when I need it. I know that this could be done with a few lines using a shell script, but that isn't what I'm looking for.
xargscould also be used asxargs -I {} sh -c '...' sh {}, if one wanted to (it makes it possible to run parallel jobs with-Pif one wanted to). – Kusalananda Mar 18 '19 at 17:23shin the very end as in... sh {} \;. Would you mind clarifying? @terdon – Boson Bear Mar 31 '22 at 14:03