Skip to content

Instantly share code, notes, and snippets.

@earthgecko
Created June 29, 2020 12:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save earthgecko/03a6f42e10bad6edd6c571f46f7c90db to your computer and use it in GitHub Desktop.
Save earthgecko/03a6f42e10bad6edd6c571f46f7c90db to your computer and use it in GitHub Desktop.
Covert Pipfile.lock to requirements.txt in pure bash
cat Pipfile.lock \
| grep -B1 '"hashes"\|"version": ' \
| grep -v '"markers": \|"hashes": ' \
| grep ": {\|version" \
| sed -e 's/: {$//g' \
| tr '\n' ',' | tr -s ' ' ' ' \
| sed -e 's/, "version": "//g;s/", "/ /g;s/"//g;s/,//g' \
| tr ' ' '\n' \
| grep -v "^$" > requirements.txt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment