Problem: I need to get a list of all java libraries in our repository so I can create a matrix of when they are being used and what is type of license they are using. I tried using a pure Windows approach but it is taking too much time so I used Cygwin instead. Getting all JAR files is easy with find but I am having difficulty brewing the correct regexp syntax so why prolong the agony and not switch to another tool instead: awk!

find . -name *.jar | awk -F/ ร‚ยด{$NF}' | sort | uniq

where:

– find searches recursively from the current directly for all files that end with ‘.jar’
– all resulting file paths are piped to awk which, using the forward slash as the column delimiter, prints out the last column
– and finally the list of JAR files are sorted alphabetically and duplicates are removed.

This could probably be done in a whole lot of ways (perl, python, sed, etc.) but the beauty of FLOSS is we can use whatever we can to get the same result. ๐Ÿ˜€

ciao!