I'm using the Informix DB. I want to detect what index the table has using command line. I used
dbschema -d dbName -t tableName | grep index
to detect the index. What's my problem is that the dbschema output format is not specified (hard to automatically parse it) so I don't think it is reliable. Is there any better way to automatically detect the index instead of read by human?
Best Answer
I think understand your problem.
The dbaccess break lines at the middle of the statement and the table name goes to line bellow... Something like this (dbschema output)
I consider two solutions 100% functional...
First suggestion
Parse the dbschema with awk to join the lines until found a semicolon.
This will give to you long lines... Then you can work little more with awk/sed to get only the index and table name... not so hard.
But this probably will become a shell script.
Second suggestion
Query the database.
For this , they should be a script and your user should have access to database with dbaccess