Commit 94b1f0ec authored by frozar's avatar frozar

[DEV] Add basic scripts.

parent 09b9b23b
#!/bin/bash
files=( $(ls mod_[A-Z][A-Z][A-Z][A-Z][a-z0-9].f90) )
first_file=${files[0]}
# echo $first_file
subroutines=$(to_del=$(echo $first_file | sed "s/mod//g;s/.f90//g"); grep -i "subroutine" mod${to_del}.f90 | grep -vi -e "end subroutine" -e "\!\!" -e " *!" | grep -i subroutine | sed "s/ *subroutine //g;s/ *SUBROUTINE //g;s/(.*//g" | sort | sed "s/${to_del}//g")
# grep -i "subroutine *CLALp2ENT" mod_CLJCx.f90
# grep -i "subroutine *clean_memory" mod_CLJCx.f90
i=0
# for s in CLALp2ENT clean_memory
for s in ${subroutines[*]}
do
# echo " s:" $s
in_all="true"
# for f in mod_CLALp.f90 mod_CLJCx.f90
for f in ${files[*]}
do
# echo " the test"
# echo $(grep -i "subroutine *${s}" ${f})
if [ "`grep -i "subroutine *${s}" ${f}`" == "" ]
then
# echo " f:" $f
# grep -i "subroutine *${s}" ${f}
in_all="false"
fi
done
# echo " in_all:" $in_all
# echo ""
if [ $in_all == "true" ]
then
elected_subroutines[${i}]=$s
i=$((${i} + 1))
fi
done
# echo ${elected_subroutines[*]}
for i in ${elected_subroutines[*]}
do
echo $i
done
echo "Array length:" ${#elected_subroutines[*]}
#!/bin/bash
usage(){
# display the number of argument given
# echo $#
echo " Usage:" $0 "<subroutine_name>"
}
files=( $(ls mod_[A-Z][A-Z][A-Z][A-Z][a-z0-9].f90) )
if [ $# -ne 1 ]
then
usage
exit -1
fi
sub=$1
outfile=l_s_${sub}
>$outfile
(
for f in ${files[*]}
do
echo " ====== $f"
beg=`grep -ni -e "^ *subroutine *${sub}_" -e "^ *end *subroutine" $f | grep -i -e "^[0-9]*: *subroutine *$sub" -A1 | head -n1 | cut -d":" -f1`
end=`grep -ni -e "^ *subroutine *${sub}_" -e "^ *end *subroutine" $f | grep -i -e "^[0-9]*: *subroutine *$sub" -A1 | tail -n1 | cut -d":" -f1`
head -n $end $f | tail -n $((${end}-${beg}+1))
echo " ====== END $f"
echo ""
done
) > $outfile
#!/bin/bash
usage(){
# display the number of argument given
# echo $#
echo " Usage:" $0 "<subroutine_name>"
}
files=( $(ls mod_[A-Z][A-Z][A-Z][A-Z][a-z0-9].f90) )
if [ $# -ne 1 ]
then
usage
exit -1
fi
typ=$1
outfile=l_t_${typ}
>$outfile
(
for f in ${files[*]}
do
echo " ====== $f"
beg=`grep -ni -e "^ *type *${typ}_" -e "^ *end *type" $f | grep -i -e "^[0-9]*: *type *$typ" -A1 | head -n1 | cut -d":" -f1`
end=`grep -ni -e "^ *type *${typ}_" -e "^ *end *type" $f | grep -i -e "^[0-9]*: *type *$typ" -A1 | tail -n1 | cut -d":" -f1`
head -n $end $f | tail -n $((${end}-${beg}+1))
echo " ====== END $f"
echo ""
done
) > $outfile
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