how to strip the file name is file name is test-5.2.3-25-patch and we only want to strip the numeric numbers 5.2.3-25 in this file
a regular expression to only strip file name
file_name=”test-5.2.3-25-patch”
numeric_part=$(echo “$file_name” | grep -oP ‘d+.d+.d+-d+’): Use grep with the -oP options to extract the numeric part.
New contributor
Adil Mirza is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.