The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com




View Single Post in the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
  #2 (permalink)  
Old 06-28-2006
thestevew thestevew is offline
Registered User
  
 

Join Date: Mar 2006
Location: South Yorkshire, UK
Posts: 114
Quick and dirty code to re-format your queries - assumes that each one starts with a comment preceded by "--"
Code:
while read a
do
if [[ $a = --* ]]; then
  print
  lf=$(echo $a|wc -w);
  print -n "$(echo $a|cut -d' ' -f $lf) |"
else
  print -n " "$a
fi
done < YourOriginalFile > YourReformattedFile
cheers