The UNIX and Linux Forums  


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
how to check prefix and postfix mail2sant Shell Programming and Scripting 2 04-16-2008 05:07 AM
Help removing the prefix of more than 10,000 files bbbngowc Shell Programming and Scripting 8 04-02-2008 10:53 PM
Need to replace a . with / which is having a matching Prefix pbsrinivas Shell Programming and Scripting 9 11-06-2006 09:25 AM
Getting emials with SUSPECT: Prefix akrathi UNIX for Dummies Questions & Answers 1 02-21-2006 03:11 PM
remove filename prefix peter.herlihy UNIX for Dummies Questions & Answers 2 07-11-2002 02:08 AM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 02-19-2006
nir_s nir_s is offline
Registered User
  
 

Join Date: Jun 2004
Posts: 148
How to cut prefix from a string?

Hi folks,

I have the following parameter setting:
export ADMIN_HOST_NAME=http://hostname.com

I want to define a new parameter,ADMIN_HOST_NAME_NEW,which based on $ADMIN_HOST_NAME but I need to remove the prefix "http://".
The requested result for $ADMIN_HOST_NAME_NEW is hostname.com

How to cut this prefix from the parameter?

Thanks in advance,
Nir
  #2 (permalink)  
Old 02-19-2006
vgersh99's Avatar
vgersh99 vgersh99 is online now Forum Staff  
Moderator
  
 

Join Date: Feb 2005
Location: Boston, MA
Posts: 5,131

Code:
#!/bin/ksh

a='http://hostname.com'
b="${a##http://}"
echo "${b}"

  #3 (permalink)  
Old 02-19-2006
nir_s nir_s is offline
Registered User
  
 

Join Date: Jun 2004
Posts: 148
Hi vgersh99,

Thanks a lot!
It works perfect!

Regards,
Nir
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 06:47 AM.


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