Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 17 Dec 2009 08:11:06 +0100
From:      Troels Kofoed Jacobsen <tkjacobsen@gmail.com>
To:        freebsd-ports@freebsd.org
Cc:        chuckr@telenix.org
Subject:   Re: trying to fix a sed line
Message-ID:  <20091217071106.GA1401@photon.std>
In-Reply-To: <4B295701.2000908@telenix.org>
References:  <4B295701.2000908@telenix.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Wed, Dec 16, 2009 at 04:54:09PM -0500, Chuck Robey wrote:
> I don't do enough in sed .... if I could figure out what it is that the broken
> line is TRYING to do, I think maybe I could fix it, I HAVE used sed before, and
> I know about the s command, and how it sets it's delimiters.  Anyhow, here's the
> broken line, and I hope my mailer doesn't decide to break the line for me:
> 
> REINPLACE_ARGS= -i.bak -E -e "1s,^(\#!.* )python$$,\1 -S PYTHONPATH=${DATADIR}
> ${PYTHON_CMD},1"

Inside "" we have

1s                  make a find replace in first line
^(\#!.* )python$$   Is a regexp matching what to be replaced:
                    #!/usr/bin/env python
                    In detail:
                        ^       matches start of line
                        ()      marks a group
                        \#!.*   matches /usr/bin/env (ending with a
                                 space)
                        python  matches python!
                        $       matches end of line. I think this could
                                be the error as the line only ends once
\1 -S PYTHONPATH=${DATADIR} ${PYTHON_CMD}
                    This is what the previous expression is replaced
                    with:
                    \1  puts what was in the group () from first regexp
                        e.g. #!/usr/bin/env 
                    The rest is just to set the pythonpath before
                    executing python. I have never seen this though and
                    do not know if it will work

Best regards
Troels Kofoed Jacobsen


chuckr@telenix.org
> 
> should be only a single space between ${DATADIR} and ${PYTHON_CMD}, my mailer
> put a line break in there for me ...
> 
> If you care, this came from editors/spe/Makefile.
> _______________________________________________
> freebsd-ports@freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-ports
> To unsubscribe, send any mail to "freebsd-ports-unsubscribe@freebsd.org"



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20091217071106.GA1401>