Discussion:
ls files with no extension
(too old to reply)
Peter
2007-09-24 20:30:04 UTC
Permalink
Could someone show me the proper way to display only files that have no
dot and extension?

If I have files
fee
fi
fo
fum
foo.bar

what is the ls syntax to only show the first 4? Is there a regex required?
If so, how does it work?

TIA
--
Peter
Erik Max Francis
2007-09-24 22:22:37 UTC
Permalink
Post by Peter
Could someone show me the proper way to display only files that have no
dot and extension?
If I have files
fee
fi
fo
fum
foo.bar
what is the ls syntax to only show the first 4? Is there a regex required?
If so, how does it work?
ls | grep -v '\.'

or, with zsh,

ls *~*.*
--
Erik Max Francis && ***@alcyone.com && http://www.alcyone.com/max/
San Jose, CA, USA && 37 20 N 121 53 W && AIM, Y!M erikmaxfrancis
Triumph cannot help but be cruel.
-- Jose Ortega y Gasset, 1925
Peter
2007-09-25 08:53:43 UTC
Permalink
On Mon, 24 Sep 2007 15:22:37 -0700, Erik Max Francis wrote:

snip...
Post by Erik Max Francis
Post by Peter
what is the ls syntax to only show the first 4? Is there a regex
required? If so, how does it work?
ls | grep -v '\.'
or, with zsh,
ls *~*.*
Thanks. Is there NO way to preserve the ls output? Must it be piped
through grep?

On a related matter, how about the find command? Is that doable?
--
Peter
Erik Max Francis
2007-09-25 08:55:36 UTC
Permalink
Post by Peter
Thanks. Is there NO way to preserve the ls output? Must it be piped
through grep?
Don't think so.
Post by Peter
On a related matter, how about the find command? Is that doable?
find . \! -name '*.*'
--
Erik Max Francis && ***@alcyone.com && http://www.alcyone.com/max/
San Jose, CA, USA && 37 20 N 121 53 W && AIM, Y!M erikmaxfrancis
There is no fate that cannot be surmounted by scorn.
-- Albert Camus
Loading...