Re: Colors/bold chars in a select?

Поиск
Список
Период
Сортировка
От Andrew Chambers
Тема Re: Colors/bold chars in a select?
Дата
Msg-id 20060415123147.GB12186@yapgi.hopto.org
обсуждение исходный текст
Ответ на Re: Colors/bold chars in a select?  (Ennio-Sr <nasr.laili@tin.it>)
Ответы Re: Colors/bold chars in a select?
Список pgsql-novice
* Ennio-Sr <nasr.laili@tin.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

В списке pgsql-novice по дате отправления:

Предыдущее
От: Bruce Momjian
Дата:
Сообщение: Re: Crontab problem with backup
Следующее
От: Frank Bax
Дата:
Сообщение: Re: Crontab problem with backup