The UNIX and Linux Forums  

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 -->
  #7 (permalink)  
Old 06-21-2008
fpmurphy's Avatar
fpmurphy fpmurphy is offline Forum Staff  
Moderator
  
 

Join Date: Dec 2003
Location: Florida
Posts: 1,945
A pure Korn shell solution

Code:
#!/usr/bin/ksh93

typeset -L1 -u firstF
typeset -L1 -u firstL

while read a b c d e
do
   if [[ $a == "totalcount" ]]; then
       nameF=$b
       nameL=$c
       numD=$d
       numE=$e
   fi
   if [[ $a == "total" ]]; then
       firstF=$nameF
       firstL=$nameL
       print "${firstF}${nameF#?}, ${firstL}${nameL#?}, $b, $numD, $numE"
   fi
done < file