2

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?

3 Answers 3

2
grep "self.VERSION = '.*'" Controller.py | cut -d "'" -f 2 > file
Sign up to request clarification or add additional context in comments.

Comments

2

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

Comments

1

you can use awk,

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

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.