I have a command like
echo "abcd0001gfh.DAT" | sed 's/^[^0-9]*\(....\).*$/\1/' | awk '{ print "00"$0 }'
This will give me an output of 000001. But I want to run this in a loop where I receive the file name from 0001-9999 and again it becomes 0001. So my output should like below
abcd0001gfh.DAT 000001
abcd0002gfh.DAT 000002
.
.
.
abcd9999gfh.DAT 009999
abcd0001gfh.DAT 010001
.
.
abcd9999gfh.DAT 019999
abcd0001gfh.DAT 020001
There is also a chance that I will receive 0005 after 0002 and here I consider 0003 and 0004 as missing sequences.
I want a limit to be set so the value of the prefix ranges from 00-99 i.e., the value can go up to 999999. So the loop should go until 9999 is received 99 times in the input file.
How could this be done in a shell script?