  | |  | formatting a string | formatting a string 2005-02-28 - By Michael Schwendt
Back On Mon, 28 Feb 2005 09:56:23 -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
$ echo "20050202 " | sed -r 's!([0-9]{4})([0-9]{2})([0-9]{2})!\1-\2-\3! '
2005-02-02
--
Fedora Core release Rawhide (Rawhide) - Linux 2.6.10-1.1155_FC4
loadavg: 0.40 0.15 0.08
--
redhat-list mailing list
unsubscribe mailto:redhat-list-request@(protected)?subject=unsubscribe
https://www.redhat.com/mailman/listinfo/redhat-list
|
|
 |