#!/usr/bin/perl while(<>) { # Look for the first pattern that looks like a version. This must be # the most recent version. if(/Version\s(\d+\.\d+(?:\.\d+))/) { print $1; exit(0); } } exit(1);