Run script on multiple files

Hi Guys,
I've been having a look around to try and understand how i can do the below however havent come across anything that will work.

Basically I have a parser script that I need to run across all files in a certain directory, I can do this one my by one on comand line however I have 100's of files to do.

Could anyone be kind enough to help out ?

On command line I use the below command

./parsercgf -dict cus3 -file_format cus3 -parse_file file_name.p >  file_name.txt

Note the items shown in red are the input file and output file, my files are actually all named differently (file name includes numbers,letters and underscores) I need the output name to be exactly the same as the input name just with a different extension on the output file.

Thanks for your help as aways.

Try something like:

for file in *.p
do	./parsercgf -dict cus3 -file_format cus3 -parse_file "$file" >"${file%.p}".txt
done