Awk to grab colo(u)r codes from CSS files aka School me in Awk

Posted by Andrew Bolster on Stack Overflow See other posts from Stack Overflow or by Andrew Bolster
Published on 2010-04-02T16:00:25Z Indexed on 2010/04/02 16:03 UTC
Read the original article Hit count: 614

Filed under:
|
|

Nice and (hopefully) easy. I am trying to work out how to grab the variable #XXX from a text file (css file) containing strings like

hr { margin: 18px 0 17px; border-color: #ccc; }

h1 a:hover, h2 a:hover, h3 a:hover { color: #001100; }

Which I would like to return as

ccc

777

The plan then is to throw this through sort and uniq and the end up with a defining colourscheme for the page.

Basically, I can't work out how to go from matching /color:#...[...]/ to just printing out the wildcarded sections.

© Stack Overflow or respective owner

Related posts about awk

Related posts about css