How do you move lines of numbers based on the month

How do you move lines of numbers i.e.(131, 134, 116, etc...) based on the month? Say for instance I only wanted June numbers and not July. This is what the file looks like so far but it runs everyday in a cron job so it will build to July.

#cat backupcount.log
131 ,Thu Jun 05 08:00:41 2008
134 ,Fri Jun 06 09:41:39 2008
116 ,Sat Jun 07 08:15:24 2008
106 ,Sun Jun 08 08:15:23 2008
95 ,Mon Jun 09 08:15:23 2008
117 ,Tue Jun 10 08:15:42 2008
140 ,Wed Jun 11 08:15:37 2008

I guess my problem is how do you move or copy based on the month. I thought about -mtime in relation to +30 days but some months have 28 and 31 days. How can I differentiate based on the month? :confused:

Here's an easy solution:

grep " Jun " backupcount.log > June.stuff

Then,

grep -v " Jun " backupcount.log > tmpfile.without.June
mv tmpfile.without.June backupcount.log

BTW, your message was kind of confusing. It seems like you just want to keep your log file cleaned up, and that's what I did. If you're actually trying to move files around, that's another thing entirely.
-mschwage

What I am trying to do is calculate all the numbers from the first field at the end of the month for a grand total of the month that just passed. Say for instance all of June on the 1st of July. I know I could just grab those numbers in stick them into excel but I know there is a way to do it on the command line .

Try this if you want to get every number:

awk '/Jun/ {print $0}' > output.file

or if you want to get the total

awk '/Jun/ {sum+ = $0}
END {print "grand total is:" sum}'

Sorry the input file was missed

awk '/ / { }' input.file > output.file

I can't get the total to work for the file. Is the syntax that is stated exactly how I should put it in.

using your same input file

> cat count_em 
#! /bin/bash
tot_cnt=0
while read zf
  do
  cur_cnt=$(echo "$zf" | grep "Jun" | cut -d"," -f1)
  tot_cnt=$((tot_cnt+cur_cnt))
done <backupcount.log

echo $tot_cnt
> count_em 
839
awk '/Jun/{sum+=$1}END{print "Total: "sum}' file

Thanks guys working just like u all prescribed.

I have one more question. Say for instance in December after the log file has compiled more data I want to be able to go to whatever month i want and the script reads that month and give me the output. Like a case and read statement I guess...then it gives you the information(Month) or total you want.

Let's consider this problem your next homework:)

This isn't homework my friend, anyways; I figured it out just wanted another perspective.
Thanks