On 8/9/05, Scott Granneman <[EMAIL PROTECTED]> wrote:
> ok, i solved this one on my own. here's my solution.
> 
> i created a file named "client_sites" that lists every client's domain:
> 
> ...
> www_websanity_org
> www_wildstonemedia_org
> www_wpc-stl_org
> ... and so on
> 
> then i created a script, "mv_old_log_files", that looks like this:
> 
> for i in $(cat client_sites)
> do
>   find /var/log/httpd/$i* -maxdepth 1 -mtime +1 -exec mv
> {} /var/archives_pre/$i \;
> done
> 
> that works!
> 
> once again, the find command saves the day.

That is a good one Scott. Here is the one I came up with:

#!/bin/ksh

# Create a temporary file for comparison
touch tempFile

for j in *
do
  if [[ ( -f $j ) && ( $j = www* )]]
  then
    if [[ $j -ot tempFile ]]
    then
      mv $j ${j%_[0-9]*}
    fi
  fi
done

#Now get rid of the temporary comparison file
rm tempFile

I also had a partially completed Awk script but got stumped part way
through it.

-- 
Kind regards,
Jonathan

_______________________________________________
CWE-LUG mailing list
[email protected]
http://www.cwelug.org/
http://www.cwelug.org/archives/
http://www.cwelug.org/mailinglist/

Reply via email to