Re: [GENERAL] Processing data from table using awk.

2015-10-06 Thread John McKown
On Tue, Oct 6, 2015 at 10:38 AM, Basques, Bob (CI-StPaul) < bob.basq...@ci.stpaul.mn.us> wrote: > Just to throw in an idea. > > I almost exclusively use PERL for this type of thing. A bunch of examples > out on the web using DBI, and the main aspects are portable across many > databases, not just

Re: [GENERAL] Processing data from table using awk.

2015-10-06 Thread Basques, Bob (CI-StPaul)
Just to throw in an idea. I almost exclusively use PERL for this type of thing. A bunch of examples out on the web using DBI, and the main aspects are portable across many databases, not just POSTGRES. Just my two cents. AWK would work too, I’ve used it myself, and got very complicated with i

Re: [GENERAL] Processing data from table using awk.

2015-10-06 Thread John McKown
On Tue, Oct 6, 2015 at 9:25 AM, Reid Thompson wrote: > On Tue, 2015-10-06 at 09:04 -0500, John McKown wrote: > > > I'm wanting to do some reporting on data which I have an a PostgreSQL > table. > > For lack of anything better, I've decided to see if I can do it in GNU > awk. > > > perhaps... note

Re: [GENERAL] Processing data from table using awk.

2015-10-06 Thread Reid Thompson
On Tue, 2015-10-06 at 09:04 -0500, John McKown wrote: > I'm wanting to do some reporting on data which I have an a PostgreSQL table. > For lack of anything better, I've decided to see if I can do it in GNU awk. perhaps... note the 4th extension... https://www.gnu.org/software/gawk/manual/html_n

Re: [GENERAL] Processing data from table using awk.

2015-10-06 Thread David G. Johnston
On Tue, Oct 6, 2015 at 10:15 AM, Melvin Davidson wrote: > Your best bet is something like > > #!/bin/bash > > get_data () > { > QRY=$(psql $HOST $PORT $USER $DBNAME <<_QUERY_ > > \o your_output_file > SELECT col1, col2, , coln > FROM your_table > WHERE ; > > _QUERY_ > > ) > } > > awk your_

Re: [GENERAL] Processing data from table using awk.

2015-10-06 Thread David G. Johnston
On Tue, Oct 6, 2015 at 10:04 AM, John McKown wrote: > I'm wanting to do some reporting on data which I have an a PostgreSQL > table. For lack of anything better, I've decided to see if I can do it in > GNU awk. OK, using Perl with DBI might be a better idea, I'll grant you > that. Or maybe Python

Re: [GENERAL] Processing data from table using awk.

2015-10-06 Thread Melvin Davidson
Your best bet is something like #!/bin/bash get_data () { QRY=$(psql $HOST $PORT $USER $DBNAME <<_QUERY_ \o your_output_file SELECT col1, col2, , coln FROM your_table WHERE ; _QUERY_ ) } awk your_table On Tue, Oct 6, 2015 at 10:04 AM, John McKown wrote: > I'm wanting to do some rep

[GENERAL] Processing data from table using awk.

2015-10-06 Thread John McKown
I'm wanting to do some reporting on data which I have an a PostgreSQL table. For lack of anything better, I've decided to see if I can do it in GNU awk. OK, using Perl with DBI might be a better idea, I'll grant you that. Or maybe Python or Ruby (which I don't know). But out of shear cussedness, I'