Skip to content
Advertisement

python way to find unique version of software

I’ve multiple components of a software (let’s call it XYZ) installed on my linux (RHEL 6.2) server running python 3.3.

JavaScript

I’m trying to covert my install/upgrade script from shell to python. For that I need to fetch the version number, but only once. In my python script I’ve added the below code

JavaScript

I want to use python based commands instead of awk and sort in this. I think we can use split() for awk, but couldn’t figure out the proper way for it. Can we use python sort to get unique value like sort -u in shell.

Advertisement

Answer

You can define the delimeter to use in split() method, like this:

JavaScript
User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement