Sponsored Content
Top Forums UNIX for Beginners Questions & Answers Filter valid hexadecimal color codes Post 303045972 by RudiC on Monday 20th of April 2020 03:49:25 PM
Old 04-20-2020
How about - after removing the DOS line terminators (<CR> = ^M = 0x0D = \r) that sabotage any regex -

Code:
grep -E "#[[:xdigit:]]{6}([[:xdigit:]]{2})?$" colours.txt

This User Gave Thanks to RudiC For This Post:
 

6 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Using color escape codes in less

Hi all, Not sure how "for dummies" this question is, but I'd better use understatement... A. My Environment ============== I am using RedHat Linux, version 2.6.18-53.el5. When I type less --version I get: less 394 Copyright (C) 1984-2005 Mark Nudelman ... My terminal is configured... (1 Reply)
Discussion started by: Source2Exe
1 Replies

2. UNIX for Dummies Questions & Answers

Regular expression on hex color codes

I want to have all hex color codes in a given stylesheet in uppercase, so #fff should be converted to #FFF for instance. Here is the regular expression I use to match and convert hex color codes to uppercase: sed -e 's/^#({3}$)|({6}$)/^#({3}$)|({6}$)/' main.css However, no conversion to uppercase... (6 Replies)
Discussion started by: figaro
6 Replies

3. Programming

Using ANSI color codes in gcc compiled program

I have put some yellow color codes and works well. I call the funstion using print_usage(stderr, 0); I would like to know if there is any way, to store the ansi color codes in variables and then call them inside fprintf. Or have a format followed by the strings I want to output. ... (5 Replies)
Discussion started by: kristinu
5 Replies

4. UNIX for Dummies Questions & Answers

Display file with escaped color codes

Hi, I have a file containing color codes: Fri May 25 17:13:04 2012: Starting MTA: exim4^ Loading cpufreq kernel modules...^How can I display it colorized on a linux terminal? (4 Replies)
Discussion started by: ripat
4 Replies

5. Shell Programming and Scripting

Help with awk color codes based on condition

HI i have two files say test and test1 Test.txt Code: Lun01 2TB 1.99TB 99.6% Lun02 2TB 1.99TB 99.5% Lun03 2TB 1.99TB 99.5% Lun04 2TB 1.55TB 89.6% Code: Test1.txt Lun01 2TB 1.99TB 89.5% Lun02 2TB 1.99TB 99.5% Lun03 2TB 1.99TB 99.5% Requirement is to compare... (6 Replies)
Discussion started by: venkitesh
6 Replies

6. Shell Programming and Scripting

Filter Data based on codes

Hello, I have a question on how to filter the data on multiple columns. The problem is I have one table with 25 columns, 4500 rows. I need to filter out the data based on some codes like 'XXXX', I have 25 codes to check on that table. My requirement is that which ever row has this code I... (1 Reply)
Discussion started by: sandeep309
1 Replies
ISWXDIGIT(3)						     Linux Programmer's Manual						      ISWXDIGIT(3)

NAME
iswxdigit - test for hexadecimal digit wide character SYNOPSIS
#include <wctype.h> int iswxdigit(wint_t wc); DESCRIPTION
The iswxdigit() function is the wide-character equivalent of the isxdigit(3) function. It tests whether wc is a wide character belonging to the wide-character class "xdigit". The wide-character class "xdigit" is a subclass of the wide-character class "alnum", and therefore also a subclass of the wide-character class "graph" and of the wide-character class "print". Being a subclass of the wide-character class "print", the wide-character class "xdigit" is disjoint from the wide-character class "cntrl". Being a subclass of the wide-character class "graph", the wide-character class "xdigit" is disjoint from the wide-character class "space" and its subclass "blank". Being a subclass of the wide-character class "alnum", the wide-character class "xdigit" is disjoint from the wide-character class "punct". The wide-character class "xdigit" always contains at least the letters 'A' to 'F', 'a' to 'f' and the digits '0' to '9'. RETURN VALUE
The iswxdigit() function returns nonzero if wc is a wide character belonging to the wide-character class "xdigit". Otherwise, it returns zero. ATTRIBUTES
For an explanation of the terms used in this section, see attributes(7). +------------+---------------+----------------+ |Interface | Attribute | Value | +------------+---------------+----------------+ |iswxdigit() | Thread safety | MT-Safe locale | +------------+---------------+----------------+ CONFORMING TO
POSIX.1-2001, POSIX.1-2008, C99. NOTES
The behavior of iswxdigit() depends on the LC_CTYPE category of the current locale. SEE ALSO
iswctype(3), isxdigit(3) COLOPHON
This page is part of release 4.15 of the Linux man-pages project. A description of the project, information about reporting bugs, and the latest version of this page, can be found at https://www.kernel.org/doc/man-pages/. GNU
2015-08-08 ISWXDIGIT(3)
All times are GMT -4. The time now is 09:24 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy