Tuesday, December 19, 2006

Goal: to see a python file code structure from command line.
 egrep 'def |class ' {python file}

The grep comes with cygwin seems to have problem with this:

 grep 'def |class ' web.py

but egrep works fine. Seems like 'def |class ' is not supported by standard regular expression. Or put it in another way, it's part of the extended regular expression set.

This article gives a good quick overview on grep, fgrep, and egrep.

No comments: