Formatting a date

Hi,

the date value retrieved by a parameter from the table is of the format dd/mm/yyyy. please let me know how to convert this to YYYYMMDD using sed

thanks

$ echo 31/01/2010 | sed "s;\([0-9]\{2\}\)/\([0-9]\{2\}\)/\([0-9]\{4\}\);\3\2\1;"
20100131
$ echo 31/01/2010 | awk -F"/" ' { print $3$2$1 } '
20100131

you may try something like this :

sed -e 's/(\d+)\/(\d+)\/(\d+)/$3$2$1/g' | echo $PARAM

It has been assumed here that the date value is retrieved in the parameter PARAM

A pipeline that flows upstream? :wink:

oops...plzz chng it to

echo $PARAM|sed -e 's/(\d+)\/(\d+)\/(\d+)/$3$2$1/g'
:o