Re: bash, grep, and regular expressions
On Fri, 18 Feb 2005 09:56:29 -0800, Freddy Freeloader
<fredddy@cableone.net> wrote:
> ls -al | grep -e ^d | grep -e '\<[^.][a-z]'
This is most likely matching the user and group names, which indeed do
not start with a dot and most likely begin with lowercase letters.
The date shouldn't match because it generally starts with a capital
letter, so you can try changing "ls -al" to "ls -aln" to get numeric
IDs, and see if this works.
You might try
ls -al | grep -e ^d | grep -e '\<[^.][^[:space:]]*$'
which will force grep to look at the last word in the line.
Note that this might have problems with filenames that contain spaces,
and will have problems with symlinks.
--
Michael A. Marsh
http://www.umiacs.umd.edu/~mmarsh
Reply to:
- References:
- bash, grep, and regular expressions
- From: Freddy Freeloader <fredddy@cableone.net>
- Re: bash, grep, and regular expressions
- From: Matt Zagrabelny <mzagrabe@d.umn.edu>
- Re: bash, grep, and regular expressions
- From: Freddy Freeloader <fredddy@cableone.net>
- Re: bash, grep, and regular expressions
- From: Peter Simpson <peter@petethetree.com>
- Re: bash, grep, and regular expressions
- From: Freddy Freeloader <fredddy@cableone.net>