grep "^function" *.4gl | sed "s/\(.*\):function \(.*\)(.*/\2 \1 \/^function \2(/" #### /^\s*function\s+(\w+)\s*\(/i # and then use hashes to save data so there's no s///