Berkeley CSUA MOTD:Entry 13124
Berkeley CSUA MOTD
 
WIKI | FAQ | Tech FAQ
http://csua.com/feed/
2025/05/25 [General] UID:1000 Activity:popular
5/25    

2004/4/10-11 [Computer/SW/Languages/Perl] UID:13124 Activity:low
4/9     Can one write a filename expansion pattern that, say, match all
        filenames without a '.' in it?  This would be trivial in regexp but
        I can't see how to do it in sh.
        \_ I don't think you can do it directly (at least, not in a practical
           way). You can always run the output of ls through sed easily
           enough. Finer shells like zsh also have ways to negate wildcards,
           which may help here somewhat.
        \_ something silly like [A-Za-z0-9 _]*  (etc,etc), but it really
           depends on your shell.  in /bin/sh?  eh....  This sounds like
           another of those motd problem where you're better off asking how
           you should solve the real problem instead of asking the tedious
           detail you got stuck on because you're lost in the forest looking
           at the trees.
           \- right. use ls,find,echo |fgrep -v . to generate the list. --psb
           \_ psb is right.  sh's pattern is different from regexp so that
              char class cannot have wild card multiplier.
              \_ yes I know that but if you read what I said the point is I
                 think he's doing the wrong thing.  if he tells us what he's
                 trying to do at a higher level this whole regexp problem will
                 go away if he has a better general plan.  his original q.
                 seems silly.  he could just as easily call perl or some
                 other regexp compatible parser at that point in his /bin/sh
                 program but that doesn't seem to be the point, does it?
                 \_ I am not doing SA.  I am just doing some spring cleaning
                    of the hard drive on my home pc and wondered if there is
                    a oneliner solution to a simple problem.  It's faster to
                    visually inspect than to learn perl.
                    \- use emacs dired-mode --psb
                    \_ ok then use either of psb's answers or use a different
                       shell that can deal with a regexp.