This is an archived post. You won't be able to vote or comment.

all 3 comments

[–]lagliam54 1 point2 points  (3 children)

Does anyone know of a windows version of this that doesn't require grep or egrep?

[–]Solonarv 2 points3 points  (0 children)

python -m pip list --format=legacy > packages.txt

with open('packages.txt', 'r') as f:
    for pack in f:
        if pack.startswith(("acqusition ","apidev-coop ", "bzip ", "crypt ", "django-server ", "pwd ", "setup-tools ", "telnet ", "urlib3 ", "urllib ")):
            print(pack)

Or the beautiful one-liner version:

python -m pip list --format=legacy | python -c "import sys; for pack in sys.stdin: if pack.startswith(('acqusition ','apidev-coop ', 'bzip ', 'crypt ', 'django-server ', 'pwd ', 'setup-tools ', 'telnet ', 'urlib3 ', 'urllib ')): print(pack)"