LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 03-18-2004, 09:07 AM   #1
philipina
Member
 
Registered: May 2003
Posts: 77

Rep: Reputation: 15
Count number of line in a file.


Hello,

How can I count the number of line I have in file?

Thanks in advance.

Allan.
 
Old 03-18-2004, 09:08 AM   #2
zekko
Member
 
Registered: Aug 2003
Location: Canada
Distribution: Slackware, debian
Posts: 76

Rep: Reputation: 15
In what programming language?
 
Old 03-18-2004, 09:16 AM   #3
snacky
Member
 
Registered: Feb 2004
Distribution: Debian
Posts: 286

Rep: Reputation: 30
wc -l filename
 
Old 03-18-2004, 09:16 AM   #4
snacky
Member
 
Registered: Feb 2004
Distribution: Debian
Posts: 286

Rep: Reputation: 30
er, just noticed this is the programming forum. Do it through a system call
 
Old 03-18-2004, 09:49 AM   #5
philipina
Member
 
Registered: May 2003
Posts: 77

Original Poster
Rep: Reputation: 15
Thanks
 
Old 03-18-2004, 11:12 AM   #6
Strike
Member
 
Registered: Jun 2001
Location: Houston, TX, USA
Distribution: Debian
Posts: 569

Rep: Reputation: 31
no, the programming language question was the right question, so ... what programming language?

PS there is no system call to determine the number of lines in a file (though you can use some to get it, with some manipulation/calculation)
 
Old 03-18-2004, 04:04 PM   #7
itsme86
Senior Member
 
Registered: Jan 2004
Location: Oregon, USA
Distribution: Slackware
Posts: 1,246

Rep: Reputation: 59
bash$ wc -l myfile.txt
 
Old 03-18-2004, 05:04 PM   #8
snacky
Member
 
Registered: Feb 2004
Distribution: Debian
Posts: 286

Rep: Reputation: 30
Quote:
PS there is no system call to determine the number of lines in a file (though you can use some to get it, with some manipulation/calculation)
No, I meant to use system(wc).
 
  


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
Getting Line Number in Error Log File kushalkoolwal Programming 6 10-17-2005 12:50 PM
Javasript to count number of mouse clicks LinuxLala Programming 3 06-17-2005 12:23 AM
Display line number n from a file doctorwebbox Linux - Newbie 2 01-05-2005 02:06 PM
Print line number X of a file (in shell) rheza Programming 4 01-04-2005 05:55 PM
How to count number of argument received by a script? philipina Linux - General 2 07-05-2004 02:35 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 10:34 PM.

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