[KLUG Members] datafile format unknown

Adam Williams members@kalamazoolinux.org
Fri, 26 Jul 2002 12:17:46 -0400 (EDT)


>>Looks like a pipe delimited file to me. Can be imported in just about any 
>>spreadsheet,  accessed via the ODBC TXT driver, or you could just write an 
>>awk script (the printf function there will let you set a column width, 
>>alignment, etc...).
>but I had hoped this was a special format that I didn't know.  Your 
>response set me off on a lengthy attempt to use ODBC to handle this 
>file.  I have set up the ODBC txt driver, I think, but have no idea how 
>to use odbc.  

unixODBC comes with an application called "DataManger" that lets one 
browse ODBC data sources and execute SQL statements, view results, etc...

ODBCConfig is the application to setup an ODBC data source.  Only 'root' 
cna install drivers.  Users can define their own data sources,  or root 
can define global data sources.

>I presume that with the text driver, one need not have any 
>    regular database such as postgreSQL set up but can work directly 
>with text files.  

True.  Of course "just text file" does imply some limitations.

>If you can point me in the right direction, I'd appreciate it.

ftp://kalamazoolinux.org/pub/pdf/dbaccess.pdf

>I'd love to write an awk script to lay out this data in a form of my 
>choosing.  I know awk can do this but I've never really learned awk. 
>After I recover from my frustration with ODBC, I expect to make a stab 
>at awk.

The file
yoyo|mama|swims|4.5|troop|ships|etc...
Run through 
awk -f display.awk < file
displays
      yoyo                 mama      swims    4.500  - XX     ships :    troop
where display.awk is
BEGIN {
  FS="|"
 } 
{
  printf "%10s %20s %10s %8.3f  - XX%10s : %9s", $1, $2, $3, $4, $6, $5;
}
END {}


-- 
-----------------------------------------------------------
Ximian GNOME, Evolution, LTSP, and RedHat Linux + LVM & XFS
-----------------------------------------------------------