Last active
June 21, 2017 20:53
-
-
Save wacko/4e6c61f7c6d16881c8ff02e28bd39008 to your computer and use it in GitHub Desktop.
List all the different gems on your Gemfile.lock
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
print_gems() { | |
awk '/([[:alnum:]_]+) \(/{ print $1 }' Gemfile.lock | sort -u | |
} | |
count() { | |
grep -c ^ | |
} | |
if [ "$1" == "-c" ]; then | |
print_gems | count | |
else | |
print_gems | |
fi |
Author
wacko
commented
Jun 21, 2016
I like grep -c ^
over wc -l
as it doesn't print spaces ;-)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment