On Thursday 12 January 2006 12:47 pm, Jake Peavy wrote:
> On 1/12/06, Mark Phillips <[EMAIL PROTECTED]> wrote:
>
> > There is a column in my table with string values, but the strings have
> > spaces
> > in them. I want to read the unique column values into an array in my bash
> > script, so I can
On Thursday 12 January 2006 11:40 am, George Law wrote:
> Mark,
>
>
>
> Sql is an alias to mysq -u.
>
> What about something like :
>
>
>
> declare -a TEAMS=(`echo "query"|sql|sed 's/$/",/g'|sed 's/^/"/g'|sed
> 's/"$//'`)
>
>
>
> since the query returns the results 1 per line,
On 1/12/06, Mark Phillips <[EMAIL PROTECTED]> wrote:
> There is a column in my table with string values, but the strings have
> spaces
> in them. I want to read the unique column values into an array in my bash
> script, so I can use these values in a separate query on this table. How
> do I
> get
Mark,
Sql is an alias to mysq -u.
What about something like :
declare -a TEAMS=(`echo "query"|sql|sed 's/$/",/g'|sed 's/^/"/g'|sed
's/"$//'`)
since the query returns the results 1 per line, the first sed prefixes
each line with a quote
second sed replaces the newline with quot
one answer to your question as asked would be to wrap the column in a
concat() function and put the double quotes around each row.
the better answer is to use PERL
Oops - I forgot my version of mysql - 4.0.22 running on Red Hat Linux 7.3
2.96-113 kernel 2.4.20-30.7.
Mark
On Thursday 12 January 2006 10:43 am, Mark Phillips wrote:
> There is a column in my table with string values, but the strings have
spaces
> in them. I want to read the unique column val