[ale] scripting foo

Dylan Northrup docx at io.com
Mon Nov 15 18:12:50 EST 2004


A long time ago, (15.11.04), in a galaxy far, far away, Jim Popovitch wrote:

:=I'm looking for some opinions on a better way to do something that I
:=currently do as part of a much larger lengthy script.  Basically I
:=have a program that outputs data in the following format (sans the
:=hashed lines):
:=
:=-----------------------------------
:=5 colors match RGB search:
:=     red
:=     yellow
:=     orange
:=     blue
:=     green
:=-----------------------------------
:=
:=Without using perl, and only using common progs (awk,sed,cut,etc), what 
:=is the most optimized way to return a sorted, left-justified, right-trimmed,
:=list of results like this:
:=
:=-----------------------------------
:=blue
:=green
:=orange
:=red
:=yellow
:=-----------------------------------
:=
:=
:=Tia,

Using bash:

plato> cat blah
5 colors match RGB search
        red
        yellow
        orange
        blue
        green
plato> cat blah | grep -v RGB | sed -e 's/^[ ^V^I]*//' | sort
blue
green
orange
red
yellow


Note, you'll have to use the ^V^I to make a literal tab that sed will cut
out.

*sigh* All this unix kung-fu and nobody to hire me.

-- 
Dylan Northrup - docx at io.com - http://www.io.com/~docx/
"Harder to work, harder to strive, hard to be glad to be alive, but it's 
 really worth it if you give it a try." -- Cowboy Mouth, 'Easy'



More information about the Ale mailing list