Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Shell script to get all plugins and details matching a name in the WordPress plugins repository
#!/bin/bash
echo "Name, URL, Slug"
IFS=$'\n' # make newlines the only separator
for j in `curl https://wordpress.org/plugins/search.php?page=[1-12]\&q=gravity+forms | grep '<h4>.*</h4>'`
do
echo -n "$j" | awk 'BEGIN { FS = ">" } ; { print $3 }' | awk 'BEGIN { FS = "<" } ; { print $1 }' | sed 's/\&amp\;/\&/g' | tr -d "\n"
echo -n ,
echo -n "$j" | awk 'BEGIN { FS = "\"" } ; { print $2 }' | tr -d "\n"
echo -n ,
echo -n "$j" | awk 'BEGIN { FS = "\"" } ; { print $2 }' | awk 'BEGIN { FS = "\/" } ; { print $5 }' | tr -d "\n"
echo ""
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment