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

Silly little regex question



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:

${string#substring}   # strip shortest occurence of substring from the
front of string
or
${string##substring} # strip longest occurence of substring from the
front of string

where substring is a regex.

TIA!

-- 
No no no, my fish's name is Eric, Eric the fish. He's an halibut. I am
not a looney! Why should I be tarred with the epithet looney merely
because I have a pet halibut?



Reply to: