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 -->
  #5 (permalink)  
Old 10-03-2006
Klashxx's Avatar
Klashxx Klashxx is offline Forum Advisor  
HP-UX/Linux/Oracle
  
 

Join Date: Feb 2006
Location: Almerķa, Spain
Posts: 393
Try this:


Code:
cuenta_cdrs()
{
 for dir in *
 do
  cd $dir
  for file in * 
  do 
   if [ -f $file ]
   then
    awk '
    BEGIN {print "dia", "\t", "Cantidad"}
    $1 == prev {totaldia++}
    $1 != prev {printf("%s\t%s\n",prev,totaldia);totaldia=1;prev=$1;filas++}' listacdrs
   fi 
  done
  cd .. 
 done
}

Regards.