Skip to content

Instantly share code, notes, and snippets.

@wagnerpinheiro
Created January 25, 2013 14:29
Show Gist options
  • Save wagnerpinheiro/4634837 to your computer and use it in GitHub Desktop.
Save wagnerpinheiro/4634837 to your computer and use it in GitHub Desktop.
Finding unique CSS colors with grep and perl
#!/bin/bash
#Finding unique CSS colors with grep and perl
#Just a tiny one-liner I’ve found useful to get unique CSS color values in a style sheet:
#source: http://www.itopen.it/2012/02/14/finding-unique-css-values-with-grep-and-perl/
#------------------
egrep -r '#[a-fA-F0-9]{3,6}+(\s|;)' *.css|perl -ne 'if (m/(#[a-fA-F0-9]{3,6}+)(\s|;)/){print "$1\n";}'|sort|uniq
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment