Silly little regex question

From: Eric d'Alibut (eric.halibut_at_gmail.com)
Date: 02/05/05

  • Next message: matze: "Re: Disabled German guy needs Debian, free, without downloading [was: Re: Anfrage]"
    Date: Sat, 5 Feb 2005 15:30:03 -0500
    To: debian-users <debian-user@lists.debian.org>
    
    

    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?
    -- 
    To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org 
    with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
    

  • Next message: matze: "Re: Disabled German guy needs Debian, free, without downloading [was: Re: Anfrage]"

    Relevant Pages

    • BASH script looking for critique!!
      ... I have recently written a simple shell script which I would enjoy ... Strip the URL and path from each record leaving just the actual file ... Open each "filename" and parse it for a custom tagline ... write the custom tag data to a file ...
      (alt.os.linux)
    • Re: Ignoring comments and blank lines in a data file
      ... # The following network address is commented out and should be ignored ... I plan to read these files using a loop in a shell script as follows: ... firewallout $netaddr ... This would strip the comments, but I need to also get rid of blank lines ...
      (comp.unix.shell)
    • Re: sed and comma-delimited file
      ... On Tue, September 19, 2006 9:26 am, SigmaX asdf wrote: ... I want to use a short shell script ... to strip them of the last 9 columns, leaving the same file but with ... Freddie Cash ...
      (freebsd-stable)
    • Re: sed and comma-delimited file
      ... On Tue, September 19, 2006 4:49 pm, Matt Emmerton wrote: ... shell script to strip them of the last 9 columns, ... Freddie Cash ...
      (freebsd-stable)
    • Re: sed and comma-delimited file
      ... On Tue, September 19, 2006 4:49 pm, Matt Emmerton wrote: ... shell script to strip them of the last 9 columns, ... Freddie Cash ...
      (freebsd-stable)