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 > UNIX for Advanced & Expert Users
.
google unix.com



UNIX for Advanced & Expert Users Expert-to-Expert. Learn advanced UNIX, UNIX commands, Linux, Operating Systems, System Administration, Programming, Shell, Shell Scripts, Solaris, Linux, HP-UX, AIX, OS X, BSD.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Find command - First file only neeto Shell Programming and Scripting 3 03-17-2009 04:07 AM
how to find a file named vijay in a directory using find command amirthraj_12 UNIX for Dummies Questions & Answers 6 10-25-2008 01:37 PM
How to use the command Tar to find a file steiner UNIX for Advanced & Expert Users 2 08-18-2005 10:13 AM
how to find a file in UNIX without find command? bluo Shell Programming and Scripting 3 09-25-2003 12:47 AM
Is a simple one command to find a file? E-Quality UNIX for Dummies Questions & Answers 11 09-18-2001 01:19 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 03-04-2008
kuliksco kuliksco is offline
Registered User
  
 

Join Date: Nov 2007
Posts: 9
get file name from find command

how can i get the find command to display the filename without the path.

example:

find /tmp/test

/tmp/test1
/tmp/test2
/tmp/test3

should return

test1
test2
test3

i'm using bash.

also, whats the best way to ignore the . and .. directories?

thanks!
  #2 (permalink)  
Old 03-04-2008
pooga17 pooga17 is offline
Registered User
  
 

Join Date: Dec 2007
Posts: 9
find . -name "test*" |awk -F/ '{print $NF}'
  #3 (permalink)  
Old 03-04-2008
kuliksco kuliksco is offline
Registered User
  
 

Join Date: Nov 2007
Posts: 9
Quote:
Originally Posted by pooga17 View Post
find . -name "test*" |awk -F/ '{print $NF}'
thanks this worked great!

any good ideas on an easy way to filter out the . and .. ?
  #4 (permalink)  
Old 07-18-2008
madankumar madankumar is offline
Registered User
  
 

Join Date: Jan 2008
Location: Bangalore
Posts: 8
Question

Hi Thanks it is working .... I have doubt

I want to list the files in a particular directory having *.dat without displaying the pathnames.


Ex: /home/usr/local/data
in this directory I have 5 dat files

I want to list the files of this directory with out displaying the path from home directory ..

Plz help me
  #5 (permalink)  
Old 07-18-2008
zaxxon's Avatar
zaxxon zaxxon is offline Forum Staff  
Moderator
  
 

Join Date: Sep 2007
Location: Germany
Posts: 2,285
@madankumar
Please check your original thread:
List the files without directory path

No need to hijack this one

Quote:
Hi Thanks it is working .... I have doubt
pooga17's solution works, so where is the doubt... you just have to modify the starting path and the name you are looking for...
  #6 (permalink)  
Old 03-04-2008
apsprabhu apsprabhu is offline
Registered User
  
 

Join Date: Feb 2008
Location: India
Posts: 44
hi,

i hope the below will work for you,

basename `find .....`

basename ---> diplays only the file name.
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 11:38 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