I am in a folder with lots of .txt
file, I would like to find all the files which contain both stringA
and stringB
(not necessarily on the same line), then list these files in the order of the size (from small to big)
I have tried the follows, but it doesn't work:
ls -lS | for f in *; do grep -q stringA $f && grep -l stringB $f; done
Does anyone have a good idea?
Best Answer
You can use
GNU find
: