From: | Andrew Chambers <andychambers2002(at)yahoo(dot)co(dot)uk> |
---|---|
To: | pgsql-novice(at)postgresql(dot)org |
Cc: | nasr(dot)laili(at)tin(dot)it |
Subject: | Re: Colors/bold chars in a select? |
Date: | 2006-04-15 12:31:47 |
Message-ID: | 20060415123147.GB12186@yapgi.hopto.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-novice |
* Ennio-Sr <nasr(dot)laili(at)tin(dot)it> [2006-04-14 23:27:38 +0200]:
> I'm using bash scripts which call psql commands (working in console, not
> xterm); so, I suppose I'd have to first save the query result in a
> temporary table/file and then run the loop on this table/file (no idea
> for the time being on how to do that ...).
> I've heard about php potential, but my learning curve would be too long;
> the same applies to html and css (this is a programming tool, I suppose?).
So the output is coming to the terminal? There are control codes you
can use to make text bold/colored on the terminal. For example...
echo -e "\e[32;01mGreen Hello"
should print out "Green Hello" in green text. You can probably find more
examples in the scripts that your distribution uses to start various
deamon processes (usually in /etc/init.d).
This task sounds like a job for awk. The syntax of the script below
might not be quite correct but you should be able to do something
like...
psql -f query.sql |awk ' { if($2 >= $1) print "\e[32;01m" $0
else print $0
} '
Hope this helps,
Andy Chambers
Send instant messages to your online friends http://uk.messenger.yahoo.com
From | Date | Subject | |
---|---|---|---|
Next Message | Frank Bax | 2006-04-16 12:19:54 | Re: Crontab problem with backup |
Previous Message | Volkan YAZICI | 2006-04-15 08:06:01 | Re: libpq Describe Extension [WAS: Bytea and perl] |