[freetds] Problems Connecting Debian --> MSSQL through odbc

Steve Langasek vorlon at dodds.net
Wed Jul 15 16:09:57 EDT 2009


On Wed, Jul 15, 2009 at 11:05:29AM -0400, jklowden at schemamania.org wrote:
> For the shell script line:

> 	DRIVER=$(echo ${DRIVER_LINE} \
> 	| awk -F '[[:space:]]*=[[:space:]]*' '{print $2}')

> sh -x echoes: 

> > ++ echo Driver = FreeTDS
> > ++ awk -F '[[:space:]]*=[[:space:]]*' '{print $2}'
> > + DRIVER=

> It's as though your awk doesn't accept Posix regular expressions as a field separator.  Is there any reason to think that could be so?  What does "awk --version" say?  

> $ awk --version
> GNU Awk 3.1.3
> Copyright (C) 1989, 1991-2003 Free Software Foundation.

gawk supports this syntax, mawk (the default on Debian) does not.

> For the time being, you could replace 

> 	awk -F '[[:space:]]*=[[:space:]]*' '{print $2}')
> with
> 	awk '{print $3}')

I would suggest instead

   sed -n -e's/^[^[:space:]]*[[:space:]]*=[[:space:]]*//p'

That doesn't allow for field /names/ with spaces in them, but that might be
ok?

-- 
Steve Langasek                   Give me a lever long enough and a Free OS
Debian Developer                   to set it on, and I can move the world.
Ubuntu Developer                                    http://www.debian.org/
slangasek at ubuntu.com                                     vorlon at debian.org


More information about the FreeTDS mailing list