I need to cut a portion of a string in linux
- by Abeed Salam
I have a file in a folder like this:
installer-x86_64-XXX.XX-diagnostic.run
The XXX.XX is a version number and I need the version number only. How to do it in linux?
I have this code:
#!/bin/bash
current_ver=$(find /mnt/builds/current -name '*.run'|awk -F/ '{print $NF}')
So this gives me just the name of the file correctly (minus the location, which I dont want).
But how do I only get the XXX.XX version number into a variable such as $version