UNIX Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsOperating SystemsUNIX Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
Get inside! Sample the range of functionality easily built with JMSL Library for Time Series Data Analysis, Heat Maps, Portfolio Optimization, Monte Carlo Simulation, Stock Price Charting and more. Download Now!
  #1  
Old January 26th, 2005, 05:05 AM
bubu1979 bubu1979 is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2004
Posts: 29 bubu1979 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 3 h 23 m 45 sec
Reputation Power: 0
ls files not directorys

Hi,
Just looked at the man page for ls and counldnt seem to find what I was looking for... I want a way to do an ls and ONLY shows files and not directories.. Theres an option -F which puts a / at the end of the directory names, maybe theres a way to filter out the directory names using this option and something like grep...

However the option -F puts a * at the back of some of my filters so I reckon I need some this like....

we are doing like this but there must be a simpler way right?

ls -F | grep -v "/" | sed "s/\([^*]*\)\*/\1/g"

Thanks in advance...

Anthony

Reply With Quote
  #2  
Old January 26th, 2005, 05:35 AM
NickPickering NickPickering is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2004
Location: Horley, Surrey
Posts: 3 NickPickering User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 25 m 17 sec
Reputation Power: 0
try find command

find . -type f -ls any use?
it will traverse lower directories tho

Reply With Quote
  #3  
Old January 26th, 2005, 06:12 AM
guggach guggach is offline
Contributing User
Dev Shed Beginner (1000 - 1499 posts)
 
Join Date: Jul 2004
Location: Middle Europa
Posts: 1,083 guggach User rank is Corporal (100 - 500 Reputation Level)guggach User rank is Corporal (100 - 500 Reputation Level)guggach User rank is Corporal (100 - 500 Reputation Level)guggach User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 4 Days 19 h 44 m 45 sec
Reputation Power: 9
Quote:
ls -F | grep -v "/" | sed "s/\([^*]*\)\*/\1/g"



if you DO not want a recursive 'ls', i whoud say

Quote:
ls -p | grep -v "/"
or the equivalent sed sersion
ls -p ¦ sed '/\//d'


else follow NickPickering suggestion.

Reply With Quote
Reply

Viewing: Dev Shed ForumsOperating SystemsUNIX Help > ls files not directorys


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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 2 hosted by Hostway