Xmllint pretty print, batch files

I have about 20 xml files I want to use xmllint to pretty print:

xmllint --format file01.xml > pretty_file01.xml
xmllint --format file02.xml > pretty_file02.xml
etc

Is there a way I can just use "xmllint --format" on all the current xml files so I don't have to run this command 20 times?? :frowning:

How about a for loop with seq:

for SEQ in $( seq -f "%02g" 1 20 )
do
   xmllint --format file${SEQ}.xml > pretty_file${SEQ}.xml
done

bash:

for i in {01..20}
do
 xmllint --format file$i.xml > pretty_file$i.xml
done

Thanks bipinajith, I tried what you provided and the script doesn't seem to end. I keep getting > for the next prompt.

---------- Post updated at 09:50 AM ---------- Previous update was at 09:48 AM ----------

to elixir:

what if my filenames aren't file$i.xml?? but apple.xml, banana.xml, grapes.xml??

Sigh...why don't you post your exact requirement instead of refining it at every solution provided to you?

May be you need this:

for i in *.xml
do
 xmllint --format "$i" > pretty_"$i"
done

Sorry! I tried

for i in *; do xmllint --format $i > pretty_$i; done

and it works, kinda. thanks!