Skip to content

Instantly share code, notes, and snippets.

@settermjd
Created November 30, 2017 13:52
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 settermjd/0d3797ffa811a5d4ebb7c21ba2b736a7 to your computer and use it in GitHub Desktop.
Save settermjd/0d3797ffa811a5d4ebb7c21ba2b736a7 to your computer and use it in GitHub Desktop.
Find images whose width is greater than X
#!/bin/bash
set -e
# Set the width from the first argument (could do this with getopts).
width=$1
# Filter the images using a combination of file and awk.
file images/* | awk -v width="$width" '{ if ($5 > width) print $1 }' | tr -d ':'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment