2010-07-14 51 views

回答

1

您可以用awk,

$ awk -F"['-]" '/VERSION[ \t]=/{print $2}' Controller.py 
1.6.3 
2
grep "self.VERSION = '.*'" Controller.py | cut -d "'" -f 2 > file 
2

如果你可以使用sed(1),那麼你可以使用一個命令解壓:

sed -n "s/.*self\.VERSION = '\([^']*\)'.*/\1/p" Controller.py > file