#!/bin/bash

# ------------------------------------------------------------
# RPC Project :
# RPC_block_WF : return the list of all blocks in a WF file
# P. Robert, LPP, 2012-08-30
# ------------------------------------------------------------

appli=`basename $0`
appli36=`echo "$appli                                 " | cut -c1-36`
Narg=1

if( (test $# = 1 ) && (test $1 = -h ) ) ; then hh=1 ; else hh=0 ; fi

if test $# != $Narg || test $hh = 1
   then
   echo "$appli : return the list of all blocks in a WF file"
   echo "$appli   require $Narg argument(s), ex:"
   echo "$appli   toto_WF.rff"
   echo "    toto_WF.rff : name of an input RFF WFL1 file"
   echo ""
   if test $hh = 1 ; then exit 0 ; fi
   echo "$appli36 : *** ERROR ! Command aborted." >&2
   exit 1
fi

datim1=`date +%F'  '%H':'%M':'%S `
julsec1=`date +%s`


echo " -------------------------------------------------------------------"
echo " Run of $appli.exe :"
echo " Please wait..."
echo ""

sed -n '/START INDEXED_DATA/,$p' $1 | grep "^..........T"

datim2=`date +%F'  '%H':'%M':'%S `
julsec2=`date +%s`
diff=`expr $julsec2 - $julsec1`
diffm=`echo "scale=2; $diff/60." | bc `

echo ""
echo " Starting time $appli : $datim1"
echo " Ending   time $appli : $datim2"
echo " Duration      $appli : $diff sec.  ($diffm mn.)"

echo " -------------------------------------------------------------------"


