From owner-freebsd-questions@FreeBSD.ORG Sat Jul 17 08:33:31 2004 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 6082316A4CE for ; Sat, 17 Jul 2004 08:33:31 +0000 (GMT) Received: from house.arach.net.au (house2.arach.net.au [203.30.44.85]) by mx1.FreeBSD.org (Postfix) with SMTP id A44A443D2F for ; Sat, 17 Jul 2004 08:33:29 +0000 (GMT) (envelope-from kat-free@kaqelectronics.dyndns.org) Received: (qmail 2721 invoked from network); 17 Jul 2004 08:33:27 -0000 Received: from unknown (HELO webserver.kaqelectronics.dyndns.org) (202.89.167.212) by house2.arach.net.au with SMTP for ; 17 Jul 2004 08:33:27 -0000 Received: from kaqelectronics.dyndns.org (kat.kaqelectronics.dyndns.org [192.168.0.2])id i6H8aon5022343 for ; Sat, 17 Jul 2004 16:36:50 +0800 (WST) (envelope-from kat-free@kaqelectronics.dyndns.org) Message-ID: <40F8E457.1030303@kaqelectronics.dyndns.org> Date: Sat, 17 Jul 2004 16:33:27 +0800 From: Kathy Quinlan User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.6) Gecko/20040113 X-Accept-Language: en-au, en, en-us MIME-Version: 1.0 To: Freebsd-Questions Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Subject: string manipulation in a shell script X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 17 Jul 2004 08:33:31 -0000 Hi guys and Gals, I have a simple script: #!/bin/sh a=ia$(date +%d%m%Y) tar -cf "$a.zip" "/usr/home/projects/lunaria/items all" mv $a.zip /usr/home/itemsall/ this nearly does what I want, I would like to put the time in the file name aswell. If I put the %T in the date variable, the resultant value for $a has : seperating the hours, minutes and seconds. Try as I might, I can not find away to remove the : and tar spits the dummy at them and it causes an IO device error. I looked through sed and awk, and spent an hour playing, but all to no avail. Anyhelp apreciated, Regards, Kat.