When I use, for example, the command
grep -c "a" output output2 | sed 's/[^0-9]//g'
the result is 0 for output and 20 for output2 because of its name. I want to ignore that 2 in output2‘s name. How can I do that, knowing that name can be different, for example output3?
Just cut everything but the number at the very end.