I want to write a script that takes text files as arguments and merge them. All the files consist of grouped lines divided by empty lines. I want to merge the files to stdout and the output should be "1st group from the first file then 1st group from the second file then 2nd group from 1th file..."

 Let's say that the lines in the files are formatted as "file-number_group-number_line-number" like this:

```
01_01_01

01_02_01
01_02_02
01_02_03

01_03_01
```

```
02_01_01
02_01_02

02_02_01

02_03_01
02_03_02
```
Then the output should be:

```
01_01_01
02_01_01
01_02_01
01_02_02
01_02_03
02_02_01
01_03_01
02_03_01
02_03_02
```
I tried using `paste` but I ran into problems.
```
#!/bin/bash
paste -d "\n\n" $1 $2 | sed '/^[[:space:]]*$/d'
```
and the output is this:
```
01_01_01
02_01_01
01_02_01
01_02_02
02_02_01
01_02_03
02_03_01
01_03_01
02_03_02
```
Also I want to see which file each line came from so how can I add the file numbers to the beginning of each line like this :
```
1:01_01_01
2:02_01_01
1:01_02_01
1:01_02_02
1:01_02_03
2:02_02_01
1:01_03_01
2:02_03_01
2:02_03_02
```