The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Operating Systems > AIX
Google UNIX.COM



View Single Post in UNIX Forums - Click on the Thread or Permalink to View Entire Thread -->
  #2 (permalink)  
Old 08-20-2007
Serious Sam Serious Sam is offline
Registered User
 

Join Date: Aug 2007
Posts: 14
Quote:
Originally Posted by arsheshadri View Post
Hi,

If I give ls -m /temp/tempusr/P*.* command,
I am getting the list of filenames with comma as delimiter but along with this I am getting the file path as well. i.e I am getting output as

/temp/tempusr/P1.log,/temp/tempusr/P2.log,/temp/tempusr/P3.log etc

Is there a way in which I display only the filenames not the path?

i.e P1.log,P2.log,P3.log etc.

I know I will get the results if I do cd /temp/tempusr and then ls -m P*.*
but the problem is I have to mention the path in ls command. so please suggest an alternate method.

Thanks & Regards
Sheshadri
Try this Code...

Code:
ls /temp/tempusr/P*.* | awk 'BEGIN {FS="/"}{print $4}'
Thanks
Sam..,
Reply With Quote