Download your favorite Linux distribution at LQ ISO.
Go Back > Forums > Non-*NIX Forums > Programming
User Name
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.


  Search this Thread
Old 12-15-2006, 12:22 PM   #1
Registered: Nov 2004
Location: Turkey
Distribution: slackware
Posts: 119

Rep: Reputation: 15
how many lines and words (bash)

How can i get the number of lines in a file and how can i learn the number of words in a line with using bash programming?

Old 12-15-2006, 12:28 PM   #2
Senior Member
Registered: Oct 2003
Posts: 2,461

Rep: Reputation: 184Reputation: 184
And how can I get some one else to do my homework.
Old 12-15-2006, 12:33 PM   #3
LQ Newbie
Registered: Nov 2006
Distribution: Ubuntu 7.10
Posts: 28

Rep: Reputation: 15
wc -l [FILE] print the newline counts
wc -w [FILE] print the word counts

See: man wc or info wc

Freddy Vulto
Old 12-15-2006, 12:43 PM   #4
Senior Member
Registered: Oct 2003
Location: UK
Distribution: Kubuntu 12.10 (using awesome wm though)
Posts: 3,530

Rep: Reputation: 63
Have a read of the wc manual page:
man wc
All the answers you seek are there.
Old 12-15-2006, 12:45 PM   #5
Registered: Nov 2004
Location: Turkey
Distribution: slackware
Posts: 119

Original Poster
Rep: Reputation: 15
I am so happy hearing these words from a senior member. I am only trying to improve myself on linux commands and bash nowadays. And i havent heard about a command named "wc". Thanks fvu and matthew. And for all helping penguins trying to walk.

Last edited by sharapchi; 12-15-2006 at 01:41 PM.


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
bash : remove replicator words?, how? Guru Mind Programming 13 05-18-2006 12:24 AM
Bash - How to make For read lines instead of words in a list ? landuchi Programming 10 02-15-2006 01:36 PM
[bash] Put words from file to array mispunt Programming 4 11-04-2004 10:53 AM
BASH: First words in a line JordanH Programming 7 10-24-2004 10:00 AM
Giving multiple words as argument for bash ivanatora Linux - General 5 01-07-2004 02:04 AM

All times are GMT -5. The time now is 07:01 PM.

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