Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- BEGIN{
- FS = ","
- hex_regexp = "^#[0-9a-fA-F]{8}$"
- }
- /#/{
- for (f=1; f<=NF; f++)
- {
- if ( $f ~ hex_regexp )
- {
- len = length(all_vals) + 1
- all_vals[len] = substr($f, 0, 7)
- }
- }
- }
- END{
- PROCINFO["sorted_in"] = "@val_str_asc"
- for (i in all_vals)
- {
- a = all_vals[i]
- matched = 0
- for (j in unique_vals)
- {
- b = unique_vals[j]
- if (a == b)
- {
- matched = 1
- break
- }
- }
- if (matched == 0)
- {
- len = length(unique_vals) + 1
- unique_vals[len] = a
- }
- }
- for (i in unique_vals)
- {
- if ( i != length(unique_vals) )
- print "\"" unique_vals[i] "\","
- else
- print "\"" unique_vals[i] "\""
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement