Re: string to date KSH
- From: Janis Papanagnou <Janis_Papanagnou@xxxxxxxxxxx>
- Date: Thu, 26 Oct 2006 22:17:16 +0200
vishu wrote:
Could you please explain the following code in brief words.
Ed Morton wrote:
Rafael The Engel wrote:
Hello everyone,
I need your help
I have a string the contains a date "20061024"
I wand to convert it to 24/10/2006
$ date="20061024"
A string assignment.
$ tmp="${date%??}"
Strip the last two characters "24" from string 'date', store the
remainder "200610" in 'tmp'.
$ echo "${date#??????}/${tmp#????}/${tmp%??}"
Three parts separated by '/' are printed;
- strip first (#) six characters from 'date' leaving "24"
- strip first (#) four characters from 'tmp' leaving "10"
- strip the last (%) two characters from 'tmp' leaving "2006"
Janis
.24/10/2006
Regards,
Ed.
- References:
- string to date KSH
- From: Rafael The Engel
- Re: string to date KSH
- From: Ed Morton
- Re: string to date KSH
- From: vishu
- string to date KSH
- Prev by Date: Re: listing nondirectories
- Next by Date: Re: listing nondirectories
- Previous by thread: Re: string to date KSH
- Next by thread: Re: string to date KSH
- Index(es):
Relevant Pages
|