mercredi 2 mars 2016

AWK adding if statement to add zero to number range 0 to 9

Hi I need to format the date do the day field has a zero for single digit days

today=`date | awk {'print $1 " " $2  " " $3'}`

So in the above the output is

Wed Mar  2

I need to add 0 to 2 to get

Wed  Mar 02 

Ho can I add this command below or something similar to the awk command

for i in 0{1..9}; do echo $i; done

So I need to add 0/zero to $3 when it's between 1 or 9

Can you please assist?

Regards

Aucun commentaire:

Enregistrer un commentaire