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 -->
  #6 (permalink)  
Old 06-30-2006
thestevew thestevew is offline
Registered User
  
 

Join Date: Mar 2006
Location: South Yorkshire, UK
Posts: 114
That awk line is terrific!
But using shell script with same assumptions as before, to suppress zeros:
Code:
while read a
do
if [[ $a = --* ]]; then
  lf=$(echo $a|wc -w)
  secs=$(echo $a|cut -d' ' -f $lf)
  msecs=$(( $secs * 1000))
  if [ $msecs -gt 0 ]; then
    print
    print -n "$secs |"
  fi
else
  if [  $msecs -gt 0 ]; then
    print -n " "$a
  fi
fi
done < YourOriginalFile > YourReformattedFile
cheers