I have a file (call it fileA) with one-column identifiers that includes duplicates. It looks like this:

```
GO:0005515
GO:0005737
GO:0005875
GO:0005884
GO:0005200
GO:0005524
GO:0005737
...
```

I have another file (call it fileB) that contains two columns, the first column has identifiers, the other has the associated text. It looks like this:

```
GO:0000001      mitochondrion inheritance
GO:0000002      mitochondrial genome maintenance
GO:0000003      reproduction
GO:0000006      high-affinity zinc uptake transmembrane transporter activity
GO:0000007      low-affinity zinc ion transmembrane transporter activity
GO:0000009      alpha-1,6-mannosyltransferase activity
GO:0000010      trans-hexaprenyltranstransferase activity
GO:0000011      vacuole inheritance
...
```

I would like to grep with the identifiers in fileA to get matching lines with identifiers and descriptions from fileB and output it in another fileC with the same order as fileA, not fileB, while keeping duplicates.

I have tried a couple of different things:

```
fgrep -f fileA fileB > fileC
```

This does not work because the order in fileC is the order of fileB, not fileA.

```
for name in `FileA`
do
        grep "$name" FileB >> FileC
done
```

This should work, but the output is:

```
GO:0005515      protein binding
GO:0005737      cytoplasm
GO:0005737      cytoplasm
GO:0005737      cytoplasm
GO:0005737      cytoplasm
GO:0005737      cytoplasm
GO:0016301      kinase activity
GO:0005525      GTP binding
GO:0005737      cytoplasm
GO:0016021      integral component of membrane
...
```

They are not in the order of file A either (apart from the first two ones).

Any ideas?