shell+SQL

Giorgos Keramidas keramida at ceid.upatras.gr
Wed Apr 5 02:20:41 EEST 2000


On Tue, Apr 04, 2000 at 11:10:46PM +0300, OLga+NaTaLia wrote:
> heLLo All
> 
> exete diavasei to  book :" red hat linux 6 Unleashed"  ?
>  sto kefalaio 27 (sel 800-801)- Automating Tasks ,  leei o syggrafeas
> oti mporw na syndeso
> shell script me SQL. kai exei ena miso paradeigma

	hades!charon:~$ echo "select * from phones where name like 'me';" | psql phones
	select * from phones where name like 'me';
	id|name|     phone
	--+----+----------
	 0|me  |0946364656
	(1 row)

	EOF

Twra me sed kai awk, elpizo na ta phgaineis arketa kala..  Thelei ena
mikro parsing meta to output.  Sto output tou psql(1) apo tis postgres
to distribution, ksekina me kati san:

	sh query.sh "$DATABASE" "$QUERY" |\
	sed -e '1,2d' |\
	sed -n -e '1,$-3p'

- Giorgos Keramidas

--
linux-greek-users mailing list -- http://lists.hellug.gr




More information about the Linux-greek-users mailing list