I’m trying to write a grep command that will match a python function declaration, in the form
def hello(hello)
so def, one space, a word that starts with either a letter, number or an underscore, open parenthesis, another word, closed parenthesis. I’m using the command
grep ^"def "[/-a-zA-z0-9][a-zA-z0-0]*[/(][a-zA-z0-9]*[/)]$
but I get a syntax error saying unrelated token near ( . I cant figure out what i’m doing wrong. any ideas?
I think there are a couple of mistakes. Here is what should work: