Tutorial: September 2017 Archives

BASH regular expression

user-pic
Vote 0 Votes

e.g. Get http://mirror01.idc.hinet.net/CentOS/ first 7.x dir name

RE=">(7[0-9\.]+)"
[[ `curl -s http://mirror01.idc.hinet.net/CentOS/` =~ $RE ]]
echo ${BASH_REMATCH[1]}

Output:
7.0.1406

Recent Entries

About this Archive

This page is an archive of entries in the Tutorial category from September 2017.

Tutorial: June 2016 is the previous archive.

Tutorial: May 2019 is the next archive.

Find recent content on the main index or look in the archives to find all content.

Monthly Archives