help with a regex please
Fred Wright
fw at fwright.net
Sun Jun 19 21:34:00 UTC 2022
On Sun, 19 Jun 2022, Ken Cunningham wrote:
> to fix the universal build of some ports, eg jemalloc, I would like to
> strip out the host bits from these text strings, eg convert this:
>
> echo "--prefix=/opt/local --with-jemalloc-prefix= --host=aarch64-apple-darwin21.5.0 host_alias=aarch64-apple-darwin21.5.0 CC=/usr/bin/clang”
>
> to this:
>
> echo "--prefix=/opt/local --with-jemalloc-prefix= CC=/usr/bin/clang”
>
> however, my regex-fu is not strong.
>
> Anyone know the secret reinplace regex that might do that?
I presume the lack of "--" in front of the "host_alias" is a typo.
I don't know specificlly about reinplace, but here's an example with sed:
MacPro:misc fw$ cat mpregex.txt
echo "--prefix=/opt/local --with-jemalloc-prefix= --host=aarch64-apple-darwin21.5.0 --host_alias=aarch64-apple-darwin21.5.0 CC=/usr/bin/clang"
MacPro:misc fw$ sed -E 's/ --(host|host_alias)=.* / /g' mpregex.txt
echo "--prefix=/opt/local --with-jemalloc-prefix= CC=/usr/bin/clang"
Fred Wright
More information about the macports-dev
mailing list