Commit c393f38f authored by frozar's avatar frozar

[DEV] Add a script to delete the declaration of a type in a given file.

parent 94b1f0ec
#!/bin/bash
usage(){
# display the number of argument given
# echo $#
echo " Usage:" $0 "<file_name> <subroutine_name>"
}
if [ $# -ne 2 ]
then
usage
exit -1
fi
f=$1
typ=$2
f_tmp=/tmp/${f}_tmp
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`
if [ "${beg}" == "" ]
then
exit
fi
if [ "${end}" == "" ]
then
exit
fi
head -n $(( ${beg}-1 )) $f > $f_tmp
nb_line=$( wc -l $f | cut -d" " -f1 )
tail -n $(( ${nb_line} - ${end} )) $f >> $f_tmp
mv $f_tmp $f
echo "INFO: delete type $typ in $f"
......@@ -29,3 +29,5 @@ do
echo ""
done
) > $outfile
echo "INFO: $f produced"
......@@ -29,3 +29,5 @@ do
echo ""
done
) > $outfile
echo "INFO: $f produced"
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