Advertisement: Linux VPS from $4/month - contact support for custom offer.
-
Administrator
Extract/print app version number (separated by dots) out of a string on Linux
This Linux command should work to extract first occurrence of a version number out of a string.
command:
echo "airdcpp_2.12.2_webui-2.12.1_64-bit_portable.tar.gz" | grep -oP '\d+(\.\d+)*' | head -n 1
returns:
2.12.2
To return version of some Debian/Ubuntu package, this may work:
dpkg -s nicotine | grep '^Version:' | awk '{print $2}' | awk -F'-' '{print $1}'
awk after the last pipe splits the version string on the hyphen (-) and prints the first part, effectively removing any subversion
Last edited by Fli; 10-03-2024 at 09:45 AM.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
Protected by : ZB
BLOCK & StopForumSpam
Bookmarks