tags:

views:

40

answers:

3

Basically i am creating an update checker for emesene on osx. I need to find out the version number from inside this file: http://emesene.svn.sourceforge.net/viewvc/emesene/trunk/emesene/Controller.py

The version number is found at self.VERSION = 'version' in the file e.g. self.VERSION = '1.6.3'

The version number then needs to be saved in a file

Is this possible using grep?

+2  A: 
grep "self.VERSION = '.*'" Controller.py | cut -d "'" -f 2 > file
Amardeep
+1  A: 

If you can use sed(1), then you can extract it with a single command:

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

you can use awk,

$ awk -F"['-]" '/VERSION[ \t]=/{print $2}' Controller.py
1.6.3
ghostdog74