Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 16 Mar 2004 00:59:25 -0800
From:      Joshua Lokken <joshua@twobirds.us>
To:        Dave Carrera <dave@ephgroup.com>
Cc:        freebsd-questions@freebsd.org
Subject:   Re: Simple file count question
Message-ID:  <20040316085925.GA4047@voyager.swabbies.org>
In-Reply-To: <002501c40b24$8c600e10$0301a8c0@daveslaptop>
References:  <002501c40b24$8c600e10$0301a8c0@daveslaptop>

next in thread | previous in thread | raw e-mail | index | archive | help
* Dave Carrera <dave@ephgroup.com> [2004-03-15 23:02]:
> Hi List,
> 
> I know this is going to be simple but I cant find a suitable answer by
> trawling the web so I ask how do I count the number of certain files in a
> directory?
> 
> So I am in my dir and want to count how many files begin with db and show me
> the number.
> 
> I hope you can help me and thank you in advance for any help you may give
> 
> Dave C
> 

I don't know if this is the most elegant way, but

ls | grep ^db | wc -l

will do it.

-- 
Joshua

I thought my people would grow tired of killing.  But you were right,
they see it is easier than trading.  And it has its pleasures.  I feel
it myself.  Like the hunt, but with richer rewards.
		-- Apella, "A Private Little War", stardate 4211.8



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20040316085925.GA4047>