The UNIX and Linux Forums  


Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
.
google unix.com



UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
get filename from absolute path in batch program zedex Windows & DOS: Issues & Discussions 1 12-20-2008 04:26 AM
Comparing filename-substrings and remove unnecessary files cypher82 UNIX for Dummies Questions & Answers 5 06-06-2008 05:26 AM
Moving files by splitting the path embedded in the filename rahulrathod UNIX for Dummies Questions & Answers 7 04-14-2005 03:43 AM
remove filename prefix peter.herlihy UNIX for Dummies Questions & Answers 2 07-11-2002 02:08 AM
remove pound sign from filename kristy UNIX for Dummies Questions & Answers 4 02-13-2002 03:31 PM

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 08-23-2007
borgeh borgeh is offline
Registered User
  
 

Join Date: Aug 2007
Posts: 12
Remove path from filename

In a foreach loop I end up with $file containing the filename INCLUDING the whole path. I want this reduced to just the filename, but I can't seem to remember how I did it some years back. I am sure I can do it with "sed", but I am pretty sure I have seen a simpler command.

Anyone?

borgeh
  #2 (permalink)  
Old 08-23-2007
arunkumar_mca arunkumar_mca is offline
Registered User
  
 

Join Date: Oct 2004
Posts: 256
Hi ..

Please post the path .. We can extract with CUT command ..


Thanks,
Arun
  #3 (permalink)  
Old 08-23-2007
vino's Avatar
vino vino is offline Forum Staff  
Supporter (in vino veritas)
  
 

Join Date: Feb 2005
Location: Bangalore, India
Posts: 2,798
basename $file will output just the filename.
  #4 (permalink)  
Old 08-23-2007
borgeh borgeh is offline
Registered User
  
 

Join Date: Aug 2007
Posts: 12
Thanks

Thanks....basename was what I was looking for. Frustrating when you know you know but can't get it out.
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 10:33 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