From owner-freebsd-questions@FreeBSD.ORG Fri Apr 16 14:25:40 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 16E9416A4CE for ; Fri, 16 Apr 2004 14:25:40 -0700 (PDT) Received: from sv19.dfserver19.com (sv19.dfserver19.com [207.44.192.91]) by mx1.FreeBSD.org (Postfix) with ESMTP id E750543D4C for ; Fri, 16 Apr 2004 14:25:39 -0700 (PDT) (envelope-from shaun@insipidity.co.uk) Received: from host217-42-19-218.range217-42.btcentralplus.com ([217.42.19.218] helo=[192.168.1.40]) by sv19.dfserver19.com with asmtp (Exim 4.24) id 1BEaqC-0007E9-Bs; Fri, 16 Apr 2004 22:25:18 +0100 From: Shaun Friedle To: JJB In-Reply-To: <20040416161750.GA33400@happy-idiot-talk.infracaninophile.co.uk> References: <20040416050053.GA52342@falcon.midgard.homeip.net> <20040416161750.GA33400@happy-idiot-talk.infracaninophile.co.uk> Content-Type: text/plain Message-Id: <1082150741.280.13.camel@Shaun> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.4.6 Date: Fri, 16 Apr 2004 22:25:41 +0100 Content-Transfer-Encoding: 7bit X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - sv19.dfserver19.com X-AntiAbuse: Original Domain - freebsd.org X-AntiAbuse: Originator/Caller UID/GID - [0 0] / [47 12] X-AntiAbuse: Sender Address Domain - insipidity.co.uk cc: freebsd-questions@FreeBSD.org Subject: Re: timezone command 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: Fri, 16 Apr 2004 21:25:40 -0000 On Fri, 2004-04-16 at 17:17, Matthew Seaman wrote: > You can do it very easily with perl: > > #!/usr/bin/perl -w > > use POSIX (strftime); > > ($d = strftime("%z", localtime)) =~ s/(\d\d)(\d\d)/$1:$2/; > > print "$d\n"; > > but it's probably a bit too heavyweight to use perl to format the > string if you aren't already writing a whole script in perl. Instead, > try: > > date +%z | sed -e 's,\([0-9][0-9]\)\([0-9][0-9]\),\1:\2,' > > Cheers, > > Matthew Oops, didn't notice this because it was in a different thread. Well now you have two Perl solutions :) -- Shaun Friedle