[CentOS] help!

John Doe jdmls at yahoo.com
Wed Mar 24 09:54:35 UTC 2010


From: Roland RoLaNd <r_o_l_a_n_d at hotmail.com>
> i've just wrote the following :
> more ./*.csv | grep -i 
> XXX | echo "Dear XXX, This email is for informative purposes. Your total number 
> of hours for the week of `date` is: `cut  -d, -f2` hours  Kindly note that the 
> average weekly working hours is : 40." | /usr/sbin/sendEmail -t 
> ymailto="mailto:mail at domain.com" 
> href="mailto:mail at domain.com">mail at domain.com -u Test email- disregard it  
> -f 
> href="mailto:othermail at subdomain.com">othermail at subdomain.com -s 
> smtp.domain.com:25
> 
> this looks in a csv file that exists in the same 
> directory for XX and outputs the field right next to it as you notice from : 
> `cut  -d, -f2` 
> It's working pretty fine for just one user, but i have to 
> do the same for 432 person. and its obviously not as professional as it should 
> be due to the following reasons:
> 1. i have to fill the name for each 
> person in place of XXX as well as their 
> href="mailto:MAIL at domain.com">MAIL at domain.com
> 2. the date command gives 
> the hour as well which is a bit annoying

I don't really get if you have 1 csv file with one person, per line, or one file per person, or...but:

IFS=,
cat *.csv | while read 
  do
    set $LINE
    USER=$1
    TIME=$2
    WEEK=`date +"%V"`
    ...
  done

JD


      



More information about the CentOS mailing list