Dreevoo.com | Online Learning and Knowledge Sharing
 
Home | Programs | Other applications | Open source programs | How to count number of words and rows in Linux files
Guest
Click to view your profile
Topics
Programs
Languages
Recipes
Home
Shortcuts
 
 

How to count number of words and rows in Linux files

Linux wc is a simple command that enables you to find out how many words and rows does a text file or output contain.

 
  Author: mat | Version: Ubuntu 12.04 | 24th July 2013 |  
 
 
1.
 

As already mentioned we will use a wc command.

As an example let's take a file names text.txt which contains text you can see on the image.

Recommended tutorial:



 
 
2.
 

Usage of the command is pretty straight forward.

wc file_name

In our case:
wc text.txt

We get three numbers as a result
First number is the number of rows, second number represent the number of words and the third number of characters.

 
 
3.
 

The wc command can also be applied with all other programs or commands that give an output as a result.

In this case we only need to add | wc

Let's take the folder listing ls -al as an example:

ls -al | wc

 
 
 
   
  Please login to post a comment
   
 
 
online learning made for people
Dreevoo.com | CONTRIBUTE | FORUM | INFO