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

About this Entry

This page contains a single entry by Pank published on September 29, 2017 9:57 AM.

Screen reattach a session was the previous entry in this blog.

Fiddler - HTTP/HTTPS Debugging Proxy is the next entry in this blog.

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

Monthly Archives