Deriving base port/package names

Miroslav Lachman 000.fbsd at quip.cz
Fri Apr 8 06:52:54 UTC 2016


Ronald F. Guilmette wrote on 04/08/2016 04:47:
>
> Given a list of all current FreeBSD ports/package, such as a (plain text
> version) the list found here:
>
>     https://www.freebsd.org/ports/master-index.html
>
> and assuming that all text past the ' -- ' has already been deleted
> from each line, what would be a proper sort of sed command to extract
> _just_ the port/package names, without the version numbers attached?

If your plaintext master-index xontains full lines like this

yorick-2.2.04_1 -- Interpreted language for scientific simulations

Than you can use this sed line

# sed 's/-[0-9a-z.,_+]* --.*$//g' master-index.txt

If you have the index stripped to

yorick-2.2.04_1

This will do the trick
sed 's/-[0-9a-z.,_+]*$//g' master-index.txt

Miroslav Lachman


More information about the freebsd-ports mailing list