Skip to content

Instantly share code, notes, and snippets.

@raviprakashgiri
Created March 16, 2018 23:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save raviprakashgiri/8e46929d847a2c7e3f8be02077b20acc to your computer and use it in GitHub Desktop.
Save raviprakashgiri/8e46929d847a2c7e3f8be02077b20acc to your computer and use it in GitHub Desktop.
A command to extract ip addresses along with port numbers from a file.
# filename contains:
#===============================================================================
#==== **** || **** Orchestration and Automation
#===============================================================================
#==== User :: ****
#==== Deployment id :: ****
#==== **** Instance (running) :: Container Name something1803162156077
#==== :: **** http://10.242.65.215:38072 (default: solar/system)
#==== :: **** https://10.242.65.215:38070
#===============================================================================
arr="$(grep -o '[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}\:[0-9]\{3,10\}' filename)"
ip=(`echo ${arr}`)
echo ${arr[0]}
# Output
# 10.242.65.215:38072
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment