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
Need to strip few letters achararun Shell Programming and Scripting 5 03-11-2008 09:08 PM
Setting basename and dirname variable to simply script. liketheshell Shell Programming and Scripting 1 09-12-2007 01:36 PM
Solaris - unknown hostname - how can I change hostname? XNOR UNIX for Dummies Questions & Answers 1 03-29-2007 10:52 PM
Need to strip a string x96riley3 Shell Programming and Scripting 6 01-27-2007 09:21 AM
How to strip strins kamathg Shell Programming and Scripting 14 03-24-2006 02:04 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 06-17-2008
tink tink is offline
Registered User
  
 

Join Date: Jun 2008
Posts: 4
strip hostname from dirname?

I need to get the full path of a file minus the hostname... anyone have an easy way to do this?

What I have is:
//ourhostname/ourfullpath/filename

What I need is:
/ourfullpath/filename


hostname evaluates to 'ourhostname'

dirname evaluates to '//ourhostname/ourfullpath'

basename evaluates to 'filename'


Thanks in advance.
  #2 (permalink)  
Old 06-17-2008
danmero danmero is offline Forum Advisor  
  
 

Join Date: Nov 2007
Location: 45.48-73.63
Posts: 1,421
Use sed:
Code:
sed 's%^//[^/]*%%'
  #3 (permalink)  
Old 06-17-2008
tink tink is offline
Registered User
  
 

Join Date: Jun 2008
Posts: 4
thank you!
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 07:18 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