> > I need to format the current date ... to the pattern
> > m-d-yyyy ... date(1) seems to always put leading zeros.
>
> # date "+%m-%d-%Y" | sed 's/^0//g'
> 8-30-2008

Not quite.  That fixes the month, but not the day:

$ echo 02-04-2008 | sed 's/^0//g'
2-04-2008

(The g does nothing, because the ^ can match only at the
beginning of a line.)  This does both:

$ echo 02-04-2008 | sed -e 's/^0//' -e 's/-0*/-/'
2-4-2008
_______________________________________________
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "[EMAIL PROTECTED]"

Reply via email to