formatting a string

Ed Wilts ewilts at ewilts.org
Mon Feb 28 16:23:41 UTC 2005


On Mon, Feb 28, 2005 at 09:56:23AM -0600, Steve Buehler wrote:
> I am writing a shell script (#!/bin/sh) that will change some file names 
> around but am having trouble formatting a string.  If I have a string like 
> this:
> 20050202
> How can I change it to:
> 2005-02-02

[ewilts at scsftp ewilts]$ NEWDATE=`date -d 20050202 +%F`
[ewilts at scsftp ewilts]$ echo $NEWDATE
2005-02-02

-- 
Ed Wilts, RHCE
Mounds View, MN, USA
mailto:ewilts at ewilts.org
Member #1, Red Hat Community Ambassador Program




More information about the redhat-list mailing list