# How to feed rule with files from two lists?

**URL:** <https://root-forum.cern.ch/t/how-to-feed-rule-with-files-from-two-lists/53648>\
**Category:** Newbie\
**Created:** [February 15, 2023, 4:42pm UTC](https://root-forum.cern.ch/t/how-to-feed-rule-with-files-from-two-lists/53648 "2023-02-15T16:42:47Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![exo](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/e/8e8cbc/32.png) [@exo](https://root-forum.cern.ch/u/exo)\
**Post date:** [February 15, 2023, 4:42pm UTC](https://root-forum.cern.ch/t/how-to-feed-rule-with-files-from-two-lists/53648/1 "2023-02-15T16:42:47Z")

</div>

Hi,

Is it possible to make the Makefile read directory and parse it in pairs? So what i have a list of files in `./mydir/` that have an infix `_A1_` and `_A2_`. What I would like to do is to read the content of mydir and paste files in a pairwise manner in parallel so that i have multople paste commands that execute:

```auto
paste My_A1_001.txt My_A2_001.txt > My_001.txt
paste My_A1_002.txt My_A2_002.txt > My_002.txt
paste My_A1_003.txt My_A2_003.txt > My_003.txt
...

```

So each in its own thread …

my attempt:

```auto
L1= $(wildcard *_A1_*)
L2= $(wildcard *_A2_*)

%.paste: %.$(L1) %.$(L2)
        (paste ....have no clue what to do here... )

```

Is this even possible with makefiles ?

Thank you

---

<div class="post-metadata">

**Author:** ![jonas](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/jonas/32/24756_2.png) [@jonas](https://root-forum.cern.ch/u/jonas)\
**Post date:** [February 16, 2023, 10:57pm UTC](https://root-forum.cern.ch/t/how-to-feed-rule-with-files-from-two-lists/53648/2 "2023-02-16T22:57:05Z")

</div>

I have no idea either, but maybe ask this question somewhere else as this doesn’t have to do with ROOT.
