Issue
Input: adcheck (CentrifyDC 4.4.3-421)
Desired output: 4.4.3
What I thought would work:
/usr/share/centrifydc/bin/adcheck --version | sed -n '/Centrify DC /,/-/p'
But that outputs nothing??
Thank you!
Solution
sed 's/[[:alpha:]|(|[:space:]]//g' | awk -F- '{print $1}' <<< "(CentrifyDC 4.4.3-421)"
output: 4.4.3
Using [:space:]
to remove extras spaces.
sed
is used to remove unwanted characters and awk -F-
means use -
as field separator
Answered By - Eric Fortis Answer Checked By - Willingham (WPSolving Volunteer)