*Posible SPAM Detectado* Re: [GRASS5] Rgb to hex question
Daniel Calvelo Aros
dcalvelo at minag.gob.pe
Sun May 22 21:48:58 EDT 2005
From: Hamish <hamish_nospam at yahoo.com>
Sent: Mon, 23 May 2005 12:00:04 +1200
>
> > I need to transform r:g:b triplets to hexidecimal colors in a bash
> > shell script. Does anyone have an expression that will do that?
>
> awk with %x or %X:
>
> echo 255 | awk '{printf("%x\n", $1)}'
>
> echo 255:255:255 | tr ':' ' ' | awk '{printf("%X:%X:%X\n", $1, $2,
> $3)}'
or, one process saved:
echo 255:128:64 | awk -F: '{printf("%X:%X:%X\n",$1,$2,$3)}'
Daniel.
More information about the grass-dev
mailing list