LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 10-19-2003, 09:36 PM   #1
tmoorman
Member
 
Registered: Aug 2003
Location: Ottawa, Ontario, Canada
Distribution: Kubuntu
Posts: 50

Rep: Reputation: 15
Found file count


How do I count files that are found by find. This command returns a list of files:
find -iname 'filename*' | sort
What I want is a count of the files returned. I looked for something like 'count' but no luck.
 
Old 10-19-2003, 09:44 PM   #2
jailbait
LQ Guru
 
Registered: Feb 2003
Location: Mineral, Virginia
Distribution: Debian 8
Posts: 7,893

Rep: Reputation: 339Reputation: 339Reputation: 339Reputation: 339
"What I want is a count of the files returned."

The file names come out of find already sorted. You could use less instead:
find -iname 'filename*' | less
Then page down to the end and less will give you a line count.


___________________________________
Be prepared. Create a LifeBoat CD.
http://users.rcn.com/srstites/LifeBo...home.page.html

Steve Stites
 
Old 10-19-2003, 09:47 PM   #3
trickykid
LQ Guru
 
Registered: Jan 2001
Posts: 24,149

Rep: Reputation: 261Reputation: 261Reputation: 261
Try a wc -l at the end...

find -iname 'filename*' | sort | wc -l

No need for scrolling using less...
 
Old 10-19-2003, 09:48 PM   #4
tmoorman
Member
 
Registered: Aug 2003
Location: Ottawa, Ontario, Canada
Distribution: Kubuntu
Posts: 50

Original Poster
Rep: Reputation: 15
When I do find -iname 'blah*' I get the files in natural order, not sorted. Anyway, using 'less' works but I'll use this:
find -iname 'filename* | sort | less

Thanks.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
File count with script? fbfd1338 Linux - Newbie 4 10-23-2005 03:02 AM
command to count how many lines in a file? dr_zayus69 Linux - Software 3 01-06-2005 10:42 AM
Count number of line in a file. philipina Programming 7 03-18-2004 05:04 PM
Should posts in general count on your post count? Joey.Dale General 16 01-27-2004 01:31 AM
snmpd installed, see file, but get error file not found PCHelper Slackware 0 11-06-2003 12:44 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 05:33 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration