Skip to content

Instantly share code, notes, and snippets.

@jasonm23
Created April 23, 2010 02:20
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 jasonm23/376082 to your computer and use it in GitHub Desktop.
Save jasonm23/376082 to your computer and use it in GitHub Desktop.
grep =#HEXRGB, =\#HEXRGB or =0,0,0..=255,255,255 (rgb values)
# grep =#HEXRGB, =\#HEXRGB or =0,0,0..=255,255,255 (rgb values) from a simple 'key=value' file.
# e.g. Java # properties. (Eclipse .prefs, windows .ini)
cat file.prefs | grep -E -i -e '=\#([0-9|A-F]){6}|=\\\#[0-9|A-F]|=([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])(,([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])){2}[^ ,0-9]';
@jasonm23
Copy link
Author

The hexrgb matching could be better.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment