Adding lines to files based on file extension

I have posted this before but did not get many replies, so here it goes again.
I have several files name like this

If the file extension is 1a, I woould like to add at the beggining of the file the following sequence

If the file extension is 1b, thn the entry that should be added is the next one

So on and so forth.
I came out with the following code, which is working, but I was hoping there was a way to do the same thing using awk

#!/bin/sh
for f in *.1a
do
printf ">Reference1a\nTTGATGTGCCAACTGCGCAAATAGCAGCAGCACTACCAGGACCTTCGCCCA\n" | cat - ${f} > Converted${f}
done
for i in *.1b
do
printf ">Reference1b\nTTGATGTGCCTACCAGGACCTTCGCCCA\n" | cat - ${i} > Converted${i}
done
for e in *.3
do
printf ">Reference3\nTTGATTCGCCCA\n" | cat - ${e} > Converted${e}
done

Any ideas?
Thansk!

---------- Post updated at 08:27 PM ---------- Previous update was at 05:25 PM ----------

Anyone?

How about:

awk 'FNR==1{f="Converted"FILENAME; printf p>f} {print>f}' p=">Reference1a\nTTGATGTGCCAACTGCGCAAATAGCAGCAGCACTACCAGGACCTTCGCCCA\n" *.1a
awk 'FNR==1{f="Converted"FILENAME; printf p>f} {print>f}' p=">Reference1b\nTTGATGTGCCTACCAGGACCTTCGCCCA\n" *.1b
awk 'FNR==1{f="Converted"FILENAME; printf p>f} {print>f}' p=">Reference3\nTTGATTCGCCCA\n" *.3
1 Like

It's much better.
Thank you very much!