Search code examples
sqlunixheadersybase

Add headers to a SQL (Sybase) output


I have created a a script that execute sql (Sybase)

#!/bin/bash
command=$(
isql -U databasename_dba  -P password   -b <<EOF!
select label1, label2 from TABLE
go
EOF!
)

echo "$command" >> output_file.csv): 

All good so far, the file is produced:

Output

But as you can see, the output is represented in 1 column.

Is possible to add "Headers" and divide the column is 2 columns, my desired output would be:

Desidered Output


Solution

  • Try to remove -b.

    #!/bin/bash
    command=$(
    isql -U databasename_dba  -P password <<EOF!
    select label1, label2 from TABLE
    go
    EOF!
    )
    
    echo "$command" >> output_file.csv):