[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: bash, grep, and regular expressions



On Thu, Feb 17, 2005 at 04:08:49PM -0800, Freddy Freeloader wrote:

> Now before you flame me this is done strictly as an exercise in
> regular expressions.

The problem is that you're trying to handle too much at once. If you
simplify the problem by ONLY dealing with the filename:

    ls -a1 | egrep -v '^\.'

works fine. Note that the flag to ls is a one, not a lowercase L in this
instance. 

If you want to parse the whole long-out format the hard way, you need to
match after the time field, so:

    ls -la | egrep ':[[:digit:]]{2} [^.]'

It works for me. YMMV.

-- 
Find my Techno-Geek Journal at http://www.codegnome.org/geeklog/



Reply to: