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
how to find complete path of a file in unix yahoo! UNIX for Dummies Questions & Answers 5 07-25-2008 02:59 AM
how to find the path of a file? wrapster Shell Programming and Scripting 3 03-26-2008 10:31 AM
command to find the path of a file abhilashnair UNIX for Dummies Questions & Answers 3 02-17-2008 07:15 PM
to find the file with full path surjyap Shell Programming and Scripting 5 01-18-2008 03:26 PM
Find a file in sub-directories.. o/p just the path pranavagarwal Shell Programming and Scripting 3 11-23-2007 01:50 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 Rating: Thread Rating: 1 votes, 3.00 average. Display Modes
  #1 (permalink)  
Old 10-29-2008
samir_standing samir_standing is offline
Registered User
  
 

Join Date: Oct 2008
Posts: 11
thanks all these are working fine.
  #2 (permalink)  
Old 10-29-2008
KenJackson KenJackson is offline
Registered User
  
 

Join Date: May 2008
Location: Maryland, USA
Posts: 104
Oh, gosh. I can't believe there are so many answers without this one.
Code:
VAR="/home/samir/datas/data.txt"
NEWVAR="${VAR%/*}"
  #3 (permalink)  
Old 10-29-2008
samir_standing samir_standing is offline
Registered User
  
 

Join Date: Oct 2008
Posts: 11
Thanks, this is working fine.

If "/home/samir/datas/data.txt" is changed like "/home/samir/datas/Construction"
where Construction is a directory then how to extract "/home/samir/datas" from that.
  #4 (permalink)  
Old 10-29-2008
methyl methyl is offline
Registered User
  
 

Join Date: Mar 2008
Posts: 1,168
man dirname
  #5 (permalink)  
Old 10-29-2008
KenJackson KenJackson is offline
Registered User
  
 

Join Date: May 2008
Location: Maryland, USA
Posts: 104
This would still work as long as there is no trailing slash. It only looks at the text, not what the text means.
Code:
VAR="/home/samir/datas/Construction"
NEWVAR="${VAR%/*}"
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:30 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