formatting a string
Steve Buehler
steve at ibapp.com
Mon Feb 28 20:32:13 UTC 2005
At 10:23 AM 2/28/2005, Ed Wilts wrote:
>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
THAT is exactly what I was looking for. I am running RHEL ES 3 and my man
page doesn't have the "%F" option in it. I searched on google to get
another set of the man pages and sure enough......it is on their. I am
running:
# date --version
date (coreutils) 4.5.3
Not sure why my man pages say they are the same version, but it isn't
documented there. A "date --help" shows the option.
Anyway, thank you VERY MUCH
Steve
More information about the redhat-list
mailing list