Skip to content

Instantly share code, notes, and snippets.

@loisaidasam
Last active October 11, 2023 07:30
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save loisaidasam/d388d7b6a4049a886da51863e37da9ca to your computer and use it in GitHub Desktop.
Save loisaidasam/d388d7b6a4049a886da51863e37da9ca to your computer and use it in GitHub Desktop.
Strip out comments/whitespace/etc. from requirements.txt
#!/bin/bash
# Strip out comments/whitespace/etc. from requirements.txt
if [ -z "$1" ]
then
echo "Missing input requirements.txt dep!"
exit 1
fi
# Specifics:
#
# $ for empty lines
# \s for lines starting w/ white space
# # for lines starting w/ comments
# git+git:// for git-related dependencies
egrep -v "^($|\s|#|(git\+git://))" $1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment