Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

bash regex help 1

Status
Not open for further replies.

thedaver

IS-IT--Management
Jul 12, 2001
2,741
US
I'm having a huge brainfart on this, I know it's easy.

In bash I receive a variable string in the form of:

Code:
domain_example.com.dom

Where the "example.com" will change to any FQDN over time.

I need to extract that FQDN and make it a bash variable.

????????????????????
DOMAIN=`sed -e...................




D.E.R. Management - IT Project Management Consulting
 
How about:
[tt]
DOMAIN=`echo $STR | sed 's/.*_\(.*\)\..*/\1/'`
[/tt]
Works in Debian Linux.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top