The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
My Deleted SubDomain is mirroring main site upirate UNIX for Dummies Questions & Answers 2 03-23-2007 12:01 PM
how to know if a directory is normal one or subdomain? hello20009876 High Level Programming 1 12-08-2005 04:11 PM
domain pointer for the subdomain naik_mit Linux 0 06-22-2005 04:34 AM
email account for subdomain (HOW-TO) collins UNIX for Dummies Questions & Answers 1 08-21-2004 04:39 PM
command find returned bash: /usr/bin/find: Argument list too long yacsil Shell Programming and Scripting 1 12-15-2003 06:38 PM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 12-22-2007
nrbhole nrbhole is offline
Registered User
  
 

Join Date: Dec 2007
Posts: 18
find subdomain in url

I want to find out subdomains in the url using shell script.
e.g
narendra.eukhost.com
abc.domainname.co.uk

I want to extract narendra & abc from the above urls.
Please any one can suggest idea or script ?
  #2 (permalink)  
Old 12-22-2007
ghostdog74 ghostdog74 is offline Forum Advisor  
Registered User
  
 

Join Date: Sep 2006
Posts: 2,509
Code:
# echo $s
narendra.eukhost.com
# echo ${s%%.*}
narendra
# echo $s | awk -F"." '{print $1}'
narendra
# echo $s | python -c "print raw_input().split('.')[0]"
narendra
  #3 (permalink)  
Old 12-22-2007
nrbhole nrbhole is offline
Registered User
  
 

Join Date: Dec 2007
Posts: 18
Thanks ghostdog74 for the solution.
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 03:21 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0