trying to fix a sed line
Troels Kofoed Jacobsen
tkjacobsen at gmail.com
Thu Dec 17 07:11:11 UTC 2009
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 at 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 at freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-ports
> To unsubscribe, send any mail to "freebsd-ports-unsubscribe at freebsd.org"
More information about the freebsd-ports
mailing list