Re: utility to replace "end" with "end subroutine foo"



gsal wrote:

O.k. maybe is not the easiest thing in fortran, it gets a little
easier in C and of course it does not get any easier when using one of
those scripting languages like tcl, perl, python...

If you simplify the problem somewhat, good enough for the programs
it is likely to be used for, it isn't bad. No continuation between
the beginning of the subroutine statement and the end of the
name, no continued END statements.

I offer this in awk, which didn't take long at all.

/^ *subroutine / {
x=$2
sub("\\(.*$","",x)
}

/^ *function / {
x=$2
sub("\\(.*$","",x)
}

/^ *end *$/ {
sub(" *$","")
print $0, x
}

-- glen


.



Relevant Pages