From owner-freebsd-isp@FreeBSD.ORG Tue May 27 05:24:41 2003 Return-Path: Delivered-To: freebsd-isp@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id C979F37B401 for ; Tue, 27 May 2003 05:24:41 -0700 (PDT) Received: from web1.nexusinternetsolutions.net (web1.nexusinternetsolutions.net [206.47.131.12]) by mx1.FreeBSD.org (Postfix) with SMTP id F1CD543F3F for ; Tue, 27 May 2003 05:24:40 -0700 (PDT) (envelope-from dave@hawk-systems.com) Received: (qmail 31262 invoked from network); 27 May 2003 12:24:40 -0000 Received: from unknown (HELO ws1) (24.157.103.51) by web1.nexusinternetsolutions.net with SMTP; 27 May 2003 12:24:40 -0000 From: "Dave [Hawk-Systems]" To: Date: Tue, 27 May 2003 08:24:39 -0400 Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook IMO, Build 9.0.6604 (9.0.2911.0) X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106 Importance: Normal Subject: shell/awk scripting help - parsing directories to gain user/file information for commands X-BeenThere: freebsd-isp@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Internet Services Providers List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 27 May 2003 12:24:42 -0000 (sending to isp given the application) have a number of uses for this where I am trying to get away from maintaining lengthy text files which contain all the statically entered commands to run for a cron job... for example; - need to run webalizer of a number of user websites and directories - can run webalizer without a customized conf file, but need to provide hostname, outputdir and other such variables from the command line - can list all the log files which give the appropriate information # ls /www/*/logs/*.access_log generates... /www/user1/.logs/user1domain1.com.access_log /www/user1/.logs/user1domain2.com.access_log /www/user2/.logs/user2domain1.com.access_log /www/user2/.logs/user2domain2.com.access_log /www/user3/.logs/user3domain1.com.access_log /www/user3/.logs/user3domain2.com.access_log what I am trying to script is something that does; for i in /www/*/logs/*.access_log; ereg (user)(domain_name) from $i; do webalizer -n $domain_name -o /www/$user/stats/; done ...as this would eliminate human error in maintaining a file which contains the appropriate lines to handle this via cron or something every night. This is one example, there are a slew of other similar applications that I would use this for. have played with awk as well, just can't wrap my head around this (not a shell scripting person by trade). Any guidance or insight would be appreciated. Dave