Commit a262dddc authored by Fabien Rozar's avatar Fabien Rozar

Add a script to get the definition of unique subroutine.

parent f32609b2
#!/bin/bash
usage(){
# display the number of argument given
# echo $#
echo " Usage:" $0 "<file_name> <subroutine_name>"
echo " Example:" $0 "mod_DKDKx.f90 get_antac"
}
if [ $# -ne 2 ]
then
usage
exit -1
fi
f=$1
sub=$2
id=$(echo ${f:4:5})
beg=`grep -ni -e "^ *subroutine *${sub}_${id}" -e "^ *end *subroutine" $f | grep -i -e "^[0-9]*: *subroutine *$sub" -A1 | head -n2 | head -n1 | cut -d":" -f1`
end=`grep -ni -e "^ *subroutine *${sub}_${id}" -e "^ *end *subroutine" $f | grep -i -e "^[0-9]*: *subroutine *$sub" -A1 | head -n2 | tail -n1 | cut -d":" -f1`
head -n $end $f | tail -n $((${end}-${beg}+1))
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment