[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Silly little regex question



Eric d'Alibut wrote:

> In a shell script:
> 
> `eval date +%j`
> 
> returns the so-called "Julian" date (a misnomer I believe, but there
> it is), the number of days into the present year, aka "yearday":
> 
> $ echo `eval date +%j`
> 036
> 
> I want a regex that will strip the leading zero _or_ zeros (if it's
> January) from the yearday, using the shell contructions:

Why not just go the easy route and use "+%-j", which causes date to not pad
with leading zeroes?

Adam



Reply to: