How to avoid the spaces?

Hi I have a script which runs the isql command and takes the output in a xls file.
Is there a way to trim the spaces(leading and trailing) from all the values in the column of the xls sheet?

Please post sample input, expected output and tell us what you have tried so far.

Here is the code

echo "use ex_abc\ngo\n SELECT 'Akanksha','    ',
   audit.req_strt_dtm as 'Access Datetime','        ', 
        audit.clm_id as 'ID',' ',
        audit.req_ext_usr_id as 'LDAP User ID','  ',
        clm.num as 'Number' 
    from
    ex_abc..ex_t audit,
    ex_abc..ex_n_t clm
    \ngo" > $sql

echo "  Access Datetime \t  ID \t LDAP User ID \t Number \t " > $outputFile

isql -U$SYBASE_USER -P$SYBASE_PW -S$SYBASE_SERVER -i$sql  -w2000 -o$tempsql

grep Akanksha $tempsql >> $tempsql1

sed s/DATA// $tempsql1 >> $outputFile

In this the outputFile has 4 columns and i am getting some space in the LDAP User ID section due to which my job is failing....

I want to remove the space and make sure that the data in the column is without any leading or trailing spaces.

Cant you use one of the SQL string functions within Sybase to squeeze out the whitespace before dumping it out to a file...

It would be helpful to see that actual output. I had an issue with mySQL and Oracle heterogenous Gateway a couple years ago. Every table that was stored as a double byte unicode character displayed as "A " or the character with a trailing space.

I could not figure it out, and eventually the customer upgraded their server from Redhat 5.7 to Redhat 6.3, so I set it up with the 6.3 ODBC driver and it worked fine. In my case I had an issue with the Redhat 5 ODBC driver and it worked fine in Redhat 6.

Try resetting the COLSEP char...

How to do that?

---------- Post updated at 04:04 AM ---------- Previous update was at 04:02 AM ----------

By using LTRIM and RTRIM???