title: Formatting error while creating report using Shell Script
body: <p>HI all I am fairly new to Shell Scripting .. I was testing a sample report in which I was trying to spool the output of sql query embedded in shell script. here is my code</p>
  
  <pre><code>#!/bin/sh
  
  ORACLE_ACCESS=hr/hr@xe
  # Report file location
  FILE_LOCATION=/home/$USER/Documents/loaddata/
  #File Name
  FILE_NAME=Report_`date +%y%m%d`.csv
  
  sqlplus -s $ORACLE_ACCESS &lt;&lt;EOF 2&gt;log.txt
  set serveroutout on
  set echo off
  set first_name format A120
  
  spool ${FILE_LOCATION}${FILE_NAME}
  select first_name,last_name 
  from employees;
  exit;
  EOF
  
  sql_error=$?
  if [$sql_error !=0]; then
     echo "Error"
     exit 1
  fi
  </code></pre>
  
  <p>However I am getting a pretty badly formatted output. </p>
  
  <p>below is the sample </p>
  
  <p>FIRST_NAME           LAST_NAME                                                  </p>
  
  <hr>
  
  <p>Ellen                Abel<br>
  Sundar               Ande<br>
  Mozhe                Atkinson<br>
  David                Austin<br>
  Hermann              Baer<br>
  Shelli               Baida<br>
  Amit                 Banda<br>
  Elizabeth            Bates<br>
  Sarah                Bell<br>
  David                Bernstein<br>
  Laura                Bissot                                                     </p>
  
  <p>FIRST_NAME           LAST_NAME                                                  </p>
  
  <hr>
  
  <p>Harrison             Bloom<br>
  Alexis               Bull<br>
  Anthony              Cabrio<br>
  Gerald               Cambrault<br>
  Nanette              Cambrault<br>
  John                 Chen<br>
  Kelly                Chung<br>
  Karen                Colmenares   </p>
  
  <p>My intended output should look something like below </p>
  
  <p>First_name   Last_name
  Atlas        Levine
  John         Doe</p>
  
  <p>can somebody help?</p>