you can do your grep first, and then pipe the grep -l
output to:
awk -F'[./]|_file_' '{print $3,$4}'
or
sed 's#\.[^.]*$##;s#./##;s#_file_# #'
e.g.
kent$ echo "./my_file_0.txt
./the_file_1.txt
./my_file_2.txt
./a_file_3.txt"|awk -F'[./]|_file_' '{print $3,$4}'
my 0
the 1
my 2
a 3
kent$ echo "./my_file_0.txt
./the_file_1.txt
./my_file_2.txt
./a_file_3.txt"|sed 's#\.[^.]*$##;s#./##;s#_file_# #'
my 0
the 1
my 2
a 3