Brett wrote:
It should be relatively simple... parse the file for the function keyword at the beginning of a line, then select everything up to the first occurance of */, should be relatively simple.
Let's use sed, the stream editor!
sed -n -e '/^function /,/^ **//{;/^function /d;p;}' sourcefile.js
Ow. What happened? Check this in the manual... The -n means "no printing unless told" and -e says the next string is the program.
In the program, the first two regular expressions with a , between them selects ranges of lines, and the bit between the {}s is run only for them. That deletes the function line, but prints any other one.
There's probably a simpler way to do it.