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
help needed nnayagam Shell Programming and Scripting 2 03-07-2008 02:34 AM
Little help needed. Netghost AIX 5 08-10-2006 11:29 AM
Help needed dsravan Shell Programming and Scripting 2 07-20-2006 06:37 AM
awk help needed. cskumar Shell Programming and Scripting 0 07-20-2006 04:24 AM
Sed help needed stevefox Shell Programming and Scripting 5 12-04-2005 09:44 PM

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 08-14-2006
Registered User
 

Join Date: Aug 2006
Posts: 11
cut help needed!!!!!

/home/documents/files/scooter17.dat

I am trying to cut out everything upto scooter17.dat so that it will only print out the scooter17.dat

any ideas?
great advices will be greatly appreciated.

Thank you


********Updated***************
Thank you for the replys. It works!! However, I am trying to do that for all the folders I have, meaning /home/documents/downloads/file1.dat and so on. So is there a way for me to write on script that only prints out the file name(file1.dat) for all the folders I have?

Thank you

Last edited by scooter17; 08-15-2006 at 07:04 AM.
Reply With Quote
Forum Sponsor
  #2 (permalink)  
Old 08-14-2006
vgersh99's Avatar
Moderator
 

Join Date: Feb 2005
Location: Boston, MA
Posts: 2,994
Quote:
Originally Posted by scooter17
/home/documents/files/scooter17.dat

I am trying to cut out everything upto scooter17.dat so that it will only print out the scooter17.dat

any ideas?
great advices will be greatly appreciated.

Thank you
what exactly are you trying?
Reply With Quote
  #3 (permalink)  
Old 08-14-2006
Registered User
 

Join Date: Aug 2006
Posts: 8
try this

$ ls lst where lst is the file you are working with
lst
$ cat lst
/export/home/prdcnlt2
$ cut -d/ -f4 lst
prdcnlt2
Reply With Quote
  #4 (permalink)  
Old 08-14-2006
System Shock's Avatar
Registered User
 

Join Date: May 2006
Location: Tau Ceti V
Posts: 367
# basename /home/documents/files/scooter17.dat
scooter17.dat
Reply With Quote
  #5 (permalink)  
Old 08-15-2006
Glenn Arndt's Avatar
Anomalous Lurker
 

Join Date: Feb 2006
Location: Indianapolis, IN
Posts: 255
Using built-ins:
Code:
file=/home/documents/files/scooter17.dat
echo ${file##*/}
Reply With Quote
Google UNIX.COM
Reply

Thread Tools
Display Modes




All times are GMT -7. The time now is 06:17 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008 The CEP Blog All Rights Reserved -Ad Management by RedTyger Visit The Global Fact Book

Content Relevant URLs by vBSEO 3.2.0