Sponsored Content
Top Forums Shell Programming and Scripting Help with awk color codes based on condition Post 302988773 by venkitesh on Monday 2nd of January 2017 10:17:02 AM
Old 01-02-2017
hi

sorry its test1.txt.

reordering is not required.

just highlighting of red color is enough
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

awk script to split a file based on the condition

I have the file with the records like 4234234 US phone 3244234 US cup 2342342 CA phone 8947234 US phone 2389472 CA cup 2348972 US maps 3894234 CA phone I want the records with (US,phone) as record to be in one file, (Us, cup) in another file and (CA,cup) to be in another I mean all... (12 Replies)
Discussion started by: superprogrammer
12 Replies

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

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

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

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

6. Shell Programming and Scripting

awk to ignore multiple rows based on a condition

All, I have a text file(Inputfile.csv) with millions of rows and 100 columns. Check the sample for 2 columns below. Key,Check A,1 A,2 A, A,4 B,0 B,1 B,2 B,3 B,4 .... million rows. My requirement is to delete all the rows corresponding to all the keys which ever has at least one... (4 Replies)
Discussion started by: ks_reddy
4 Replies

7. Shell Programming and Scripting

Remove line based on condition in awk

In the following tab-delimited input, I am checking $7 for the keyword intronic. If that keyword is found then $2 is split by the . in each line and if the string after the digits or the +/- is >10, then that line is deleted. This will always be the case for intronic. If $7 is exonic then nothing... (10 Replies)
Discussion started by: cmccabe
10 Replies

8. Shell Programming and Scripting

awk to reformat lines based on condition

The awk below uses the tab-delimeted fileand reformats each line based on one of three conditions (rules). The 3 rules are for deletion (lines in blue), snv (line in red), and insertion (lines in green). I have included all possible combinations of lines from my actual data, which is very large.... (0 Replies)
Discussion started by: cmccabe
0 Replies

9. UNIX for Beginners Questions & Answers

Change the field color based on condition in email

Request your help to change the field color based on condition , if it is otherthan 0. using html in unix. Here is my condition for(i=1;i<=NF;i++) { print "<td> "$i"</td> } Please use CODE tags when displaying sample input, output, and code segments. (17 Replies)
Discussion started by: CatchMe
17 Replies

10. UNIX for Beginners Questions & Answers

awk to add +1 to value based on condition in input

In the awk below I am trying to add a | that will adjust $2 in the ouput by adding +1 if the original value from file that was used in $3 had a - in it. Line 3 of file is an example of this. In my current awk I just subtract one but I am not sure how to only apply this to those values without a -.... (5 Replies)
Discussion started by: cmccabe
5 Replies
Imager::Color(3pm)					User Contributed Perl Documentation					Imager::Color(3pm)

NAME
Imager::Color - Color handling for Imager. SYNOPSIS
use Imager; $color = Imager::Color->new($red, $green, $blue); $color = Imager::Color->new($red, $green, $blue, $alpha); $color = Imager::Color->new("#C0C0FF"); # html color specification $color->set($red, $green, $blue); $color->set($red, $green, $blue, $alpha); $color->set("#C0C0FF"); # html color specification ($red, $green, $blue, $alpha) = $color->rgba(); @hsv = $color->hsv(); $color->info(); if ($color->equals(other=>$other_color)) { ... } DESCRIPTION
This module handles creating color objects used by Imager. The idea is that in the future this module will be able to handle color space calculations as well. An Imager color consists of up to four components, each in the range 0 to 255. Unfortunately the meaning of the components can change depending on the type of image you're dealing with: o for 3 or 4 channel images the color components are red, green, blue, alpha. o for 1 or 2 channel images the color components are gray, alpha, with the other two components ignored. An alpha value of zero is fully transparent, an alpha value of 255 is fully opaque. METHODS
new This creates a color object to pass to functions that need a color argument. set This changes an already defined color. Note that this does not affect any places where the color has been used previously. rgba() This returns the red, green, blue and alpha channels of the color the object contains. info Calling info merely dumps the relevant color to the log. equals(other=>$other_color) equals(other=>$other_color, ignore_alpha=>1) Compares $self and color $other_color returning true if the color components are the same. Compares all four channels unless "ignore_alpha" is set. If "ignore_alpha" is set only the first three channels are compared. You can specify colors in several different ways, you can just supply simple values: o simple numeric parameters - if you supply 3 or 4 numeric arguments, you get a color made up of those RGB (and possibly A) components. o a six hex digit web color, either "RRGGBB" or "#RRGGBB" o an eight hex digit web color, either "RRGGBBAA" or "#RRGGBBAA". o a 3 hex digit web color, "#RGB" - a value of F becomes 255. o a color name, from whichever of the gimp "Named_Colors" file or X "rgb.txt" is found first. The same as using the "name" keyword. You can supply named parameters: o 'red', 'green' and 'blue', optionally shortened to 'r', 'g' and 'b'. The color components in the range 0 to 255. # all of the following are equivalent my $c1 = Imager::Color->new(red=>100, blue=>255, green=>0); my $c2 = Imager::Color->new(r=>100, b=>255, g=>0); my $c3 = Imager::Color->new(r=>100, blue=>255, g=>0); o "hue", "saturation" and "value", optionally shortened to "h", "s" and "v", to specify a HSV color. 0 <= hue < 360, 0 <= s <= 1 and 0 <= v <= 1. # the same as RGB(127,255,127) my $c1 = Imager::Color->new(hue=>120, v=>1, s=>0.5); my $c1 = Imager::Color->new(hue=>120, value=>1, saturation=>0.5); o "web", which can specify a 6 or 3 hex digit web color, in any of the forms "#RRGGBB", "#RGB", "RRGGBB" or "RGB". my $c1 = Imager::Color->new(web=>'#FFC0C0'); # pale red o "gray" or "grey" which specifies a single channel, from 0 to 255. # exactly the same my $c1 = Imager::Color->new(gray=>128); my $c1 = Imager::Color->new(grey=>128); o "rgb" which takes a 3 member arrayref, containing each of the red, green and blue values. # the same my $c1 = Imager::Color->new(rgb=>[255, 100, 0]); my $c1 = Imager::Color->new(r=>255, g=>100, b=>0); o "hsv" which takes a 3 member arrayref, containing each of hue, saturation and value. # the same my $c1 = Imager::Color->new(hsv=>[120, 0.5, 1]); my $c1 = Imager::Color->new(hue=>120, v=>1, s=>0.5); o "gimp" which specifies a color from a GIMP palette file. You can specify the file name of the palette file with the 'palette' parameter, or let Imager::Color look in various places, typically "$HOME/gimp-1.x/palettes/Named_Colors" with and without the version number, and in "/usr/share/gimp/palettes/". The palette file must have color names. my $c1 = Imager::Color->new(gimp=>'snow'); my $c1 = Imager::Color->new(gimp=>'snow', palette=>'testimg/test_gimp_pal); o "xname" which specifies a color from an X11 "rgb.txt" file. You can specify the file name of the "rgb.txt" file with the "palette" parameter, or let Imager::Color look in various places, typically "/usr/lib/X11/rgb.txt". my $c1 = Imager::Color->new(xname=>'blue') # usually RGB(0, 0, 255) o "builtin" which specifies a color from the built-in color table in Imager::Color::Table. The colors in this module are the same as the default X11 "rgb.txt" file. my $c1 = Imager::Color->new(builtin=>'black') # always RGB(0, 0, 0) o "name" which specifies a name from either a GIMP palette, an X "rgb.txt" file or the built-in color table, whichever is found first. o 'channel0', 'channel1', etc, each of which specifies a single channel. These can be abbreviated to 'c0', 'c1' etc. o 'channels' which takes an arrayref of the channel values. Optionally you can add an alpha channel to a color with the 'alpha' or 'a' parameter. These color specifications can be used for both constructing new colors with the new() method and modifying existing colors with the set() method. METHODS
hsv() my($h, $s, $v, $alpha) = $color->hsv(); Returns the color as a Hue/Saturation/Value/Alpha tuple. AUTHOR
Arnar M. Hrafnkelsson, addi@umich.edu And a great deal of help from others - see the "README" for a complete list. SEE ALSO
Imager(3), Imager::Color http://imager.perl.org/ perl v5.14.2 2011-06-06 Imager::Color(3pm)
All times are GMT -4. The time now is 10:57 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy