Sure, as in so many cases, a simple for loop will do.
Code:
for i in 04 05 06 07 ; do
grep -ic "may/05$i" SentEmails.txt >> Stats.txt
done
You don't need
-r (recursive search) for a single file. But you can use
-c to get a line count, instead of piping it through wc.
Just add whatever sequence of numbers or strings you need to the loop. Each one will be used in the variable ($i) in turn. You can even use
brace expansion to generate the list:
Code:
#Bash version 4 has zero-padding:
for i in {01..31} ; do
#For previous versions use this:
for i in {0{1..9},{10..31}} ; do
Here are a few useful bash scripting references:
http://www.linuxcommand.org/index.php
http://tldp.org/LDP/Bash-Beginners-G...tml/index.html
http://www.tldp.org/LDP/abs/html/index.html
http://www.gnu.org/software/bash/manual/bashref.html
http://wiki.bash-hackers.org/start
And please use
[code][/code] tags around your code, to preserve formatting and to improve readability.