Skip to content

Instantly share code, notes, and snippets.

@JeffMatson
Created August 29, 2016 03:13
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 JeffMatson/c08a81f829b2cadf2361a04c9f6b188b to your computer and use it in GitHub Desktop.
Save JeffMatson/c08a81f829b2cadf2361a04c9f6b188b to your computer and use it in GitHub Desktop.
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