Question: 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?

Answer: 
You can use `GNU find`:

```
find . -maxdepth 1 -exec grep -q stringA {} \; -exec grep -q stringB {} \; \
        -printf '%10s %p\n' | 
    sort -n

```
With `zsh` and GNU tools:

```
grep -lZ -- stringA *.txt(oL) | xargs -r0 grep -l -- stringB

```