Sponsored Content
Top Forums UNIX for Dummies Questions & Answers Regular expression on hex color codes Post 302361387 by daPeach on Tuesday 13th of October 2009 05:36:54 AM
Old 10-13-2009
Quote:
-r, --regexp-extended
use extended regular expressions in the script.
if not supported, try this instead
Code:
sed -e 's/#[0-9a-f]\{3\}\|#[0-9a-f]\{6\}/\U&/'

but sed on freeBSD might not be GNU, and as such \U won't work.

Have a look at awk's toupper function
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Regular Expression + Aritmetical Expression

Is it possible to combine a regular expression with a aritmetical expression? For example, taking a 8-numbers caracter sequece and casting each output of a grep, comparing to a constant. THX! (2 Replies)
Discussion started by: Z0mby
2 Replies

2. Shell Programming and Scripting

regular expression help

hello all.. I'm a bit new to this site.. and I hope to learn alot.. but I've been having a hard time figuring this out. I'm horrible with regular expressions.. so any help would be greatly appreciated. I have a file with a list of names like this: LASTNAME, FIRSTNAME, MIDDLEINITIAL how can... (5 Replies)
Discussion started by: mac2118
5 Replies

3. Linux

Regular expression to extract "y" from "abc/x.y.z" .... i need regular expression

Regular expression to extract "y" from "abc/x.y.z" (2 Replies)
Discussion started by: rag84dec
2 Replies

4. 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

5. Shell Programming and Scripting

Integer expression expected: with regular expression

CA_RELEASE has a value of 6. I need to check if that this is a numeric value. if not error. source $CA_VERSION_DATA if * ] then echo "CA_RELESE $CA_RELEASE is invalid" exit -1 fi + source /etc/ncgl/ca_version_data ++ CA_PRODUCT_ID=samxts ++ CA_RELEASE=6 ++ CA_WEEK_NO=7 ++... (3 Replies)
Discussion started by: ketkee1985
3 Replies

6. Programming

Perl: How to read from a file, do regular expression and then replace the found regular expression

Hi all, How am I read a file, find the match regular expression and overwrite to the same files. open DESTINATION_FILE, "<tmptravl.dat" or die "tmptravl.dat"; open NEW_DESTINATION_FILE, ">new_tmptravl.dat" or die "new_tmptravl.dat"; while (<DESTINATION_FILE>) { # print... (1 Reply)
Discussion started by: jessy83
1 Replies

7. 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

8. 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

9. UNIX for Advanced & Expert Users

sed: -e expression #1, char 0: no previous regular expression

Hello All, I'm trying to extract the lines between two consecutive elements of an array from a file. My array looks like: problem_arr=(PRS111 PRS213 PRS234) j=0 while } ] do k=`expr $j + 1` sed -n "/${problem_arr}/,/${problem_arr}/p" problemid.txt ---some operation goes... (11 Replies)
Discussion started by: InduInduIndu
11 Replies

10. 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
Graphics::Color::RGB(3pm)				User Contributed Perl Documentation				 Graphics::Color::RGB(3pm)

NAME
Graphics::Color::RGB - RGB color model VERSION
version 0.29 SYNOPSIS
use Graphics::Color::RGB; my $color = Graphics::Color::RGB->new({ red => 1, blue => .31, green => .25, }); DESCRIPTION
Graphics::Color::RGB represents a Color in the sRGB color space. Individual color channels are expressed as decimal values from 0 to 1, 0 being a lack of that color (or opaque in the case of alpha) and 1 being full color (or transparent in the case of alpha). If no options are provided then new instance of RGB are opaque white, (that is equivalent to red => 1, green => 1, blue => 1, alpha => 1). Convenience methods are supplied to convert to various string values. ATTRIBUTES
red r Set/Get the red component of this Color. Aliased to 'r' as well. green g Set/Get the green component of this Color. Aliased to 'g' as well. blue b Set/Get the blue component of this Color. Aliased to 'b' as well. alpha a Set/Get the alpha component of this Color. Aliased to 'a' as well. name Get the name of this color. Only valid if the color was created by name. METHODS
as_string Get a string version of this Color in the form of RED,GREEN,BLUE,ALPHA as_integer_string Return an integer formatted value for this color. This format is suitable for CSS RGBA values. as_css_hex Return a hex formatted value with a prepended '#' for use in CSS and HTML. as_hex_string ( [$prepend] ) Return a hex formatted value for this color. The output ignores the alpha channel because, per the W3C, there is no hexadecimal notiation for an RGBA value. Optionally allows you to include a string that will be prepended. This is a common way to add the "#". as_percent_string Return a percent formatted value for this color. This format is suitable for CSS RGBA values. as_array Get the RGB values as an array. as_array_with_alpha Get the RGBA values as an array equal_to Compares this color to the provided one. Returns 1 if true, else 0; not_equal_to The opposite of equal_to. from_color_library ($color_id) Attempts to retrieve the specified color-id using Color::Library. The result is then converted into a Graphics::Color::RGB object. from_hex_string($hex) Attempts to create a Graphics::Color::RGB object from a hex string. Works with or without the leading # and with either 3 or 6 character hex strings. to_hsl Creates this RGB color in HSL space. Returns a Graphics::Color::HSL object. to_hsv Creates this RGB color in HSV space. Returns a Graphics::Color::HSV object. AUTHOR
Cory G Watson <gphat@cpan.org> COPYRIGHT AND LICENSE
This software is copyright (c) 2011 by Cold Hard Code, LLC. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. perl v5.12.4 2011-08-11 Graphics::Color::RGB(3pm)
All times are GMT -4. The time now is 05:14 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy