GeekInterview.com
   Home |  Tech FAQ  |   Interview Questions |  Placement Papers |  Tech Articles |  Learn |  Freelance Projects |  Online Testing |  Geeks Talk |  Job Postings |  Knowledge Base | Site Search |  Add/Ask Question

GeekInterview.com  >  Interview Questions  >  Operating System  >  Unix Commands
Go To First  |  Previous Question  |  Next Question 
 Unix Commands  |  Question 11 of 73    Print  
Is it possible to count number char, line in a file; if so, How?
Yes, wc-stands for word count.
wc -c for counting number of characters in a file.
wc -l for counting lines  in a file.



  
Total Answers and Comments: 1 Last Update: March 31, 2006   
  
 Sponsored Links

 
 Best Rated Answer

No best answer available. Please pick the good answer available or submit your answer.
March 31, 2006 20:08:45   #1  
myquery Member Since: March 2006   Contribution: 14    

RE: Is it possible to count number char, line in a fil...

Yes,It is possible to count the words,lines,characters in a file..

In Unix,i used..

$wc -c filename  -> for characters

$wc -l filename   ->for lines

$wc -w filename  ->for words


 
Is this answer useful? Yes | No

 Related Questions

A pipe is two or more commands separated by pipe char '|'. That tells the shell to arrange for the output of the preceding command to be passed as input to the following command. Example : ls 
Latest Answer : The Unix commands alone are powerful, but when two or more commands get combine together, we can accomplish complex task with ease.In unix we can combine the two or more commands together to perform multiple action simulatenously with the help of Pipe ...

Directing the flow of data to the file or from the file for input or output.Example :  ls > wc 
Latest Answer : Whenever we run a command on shell prompt we get some output on shell prompt.In case we don't want to appear the output on the shell prompt we can redirect the output to the somewhere else. We can make the output which go into the file or may be directly ...

‘inode’, each file has a separate inode and a unique inode number. 
Latest Answer : The data structure that is used to maintain the In-Core Inode Information is "Inode Table". This table (logical representation) has the following information abt the file:- - type of the file - permissions on the link - Owner Id - ...

Yes, wc-stands for word count.wc -c for counting number of characters in a file.wc -l for counting lines  in a file. 
Latest Answer : Yes,It is possible to count the words,lines,characters in a file..In Unix,i used..$wc -c filename  -> for characters$wc -l filename   ->for lines$wc -w filename  ->for words ...

Yes, ‘mkfs’ is used to create a new file system. 
Latest Answer : Yes,mkfs -t filesystem  device name.for e.gmkfs -f ext3 /dev/hda2 ...

$od -cbd file_namec - character, b - binary (octal), d-decimal, od=Octal Dump. 
Latest Answer : to change the output in binery format the command is :%!xxd -b ...

Cat displays file contents. If the file is large the contents scroll off the screen before we view it. So command 'more' is like a pager which displays the contents page by page. 
Latest Answer : The cut command cuts bytes, characters, or fields from each line of a file and writes these bytes, characters, or fields to standard output. If you do not specify the File parameter, the cut command reads standard input.The more command reads files and ...

‘grep’ is a pattern search command. It searches for the pattern, specified in the command line with appropriate option, in a file(s). Syntax :      grep Example :    
Latest Answer : Grep - stands for Globally Search a Regular Expression and Print. It is used to search a given string/pattern under the given path and list out all the occurances of it in a file or set of files. Following are the options available for grep ...

After the command line is terminated by the key, the shel goes ahead  with processing the command line in one or more passes. The sequence is well defined and assumes the following order.Parsing: 
Latest Answer : when processing a command the searchs for the utility for the command in the directories specified in the PATH varible and it in invokes that utility. That utility will execute the command with help of kernel and the output is given to shell. And then ...

is the output redirection operator when used it overwrites while >> operator appends into the file. 
Latest Answer : ">" operator redirects the output to a file, if the file already existst and contains some data in it, the ">" would cause the data over written with new data.">>" Redirects the output to be appened to the end ...


 Sponsored Links

 
Related Articles

What is Data File

In a logical data model, the conceptual data model which is based on the business semantic is being defined. Thus, entities and relationships and corresponding table and column design, object oriented classes, and XML tags, among other things are being laid regardless of the database will be physica
 

On-Line Transaction Processing

On-Line Transaction Processing On-Line Transaction Processing is a processing that supports the daily business operations. Also know as operational processing and OLTP.  An OLTP is a database which must typically allow the real-time processing of SQL transactions to support traditional reta
 

On-Line Analytical Processing

On-Line Analytical Processing On-Line Analytical Processing is a processing that supports the analysis of business trends and projections. It is also known as decision support processing and OLAP.  An OLAP software enables companies to have real-time analysis of data stored in a database. A
 

What is the use of COUNT with DISTINCT option

COUNT is a group function returns result by summarizing multiple rows. All group by value function will have the usage of DISTINCT or ALL option and so is the COUNT which uses the DISTINCT option. DISTINCT option is used to enforce uniqueness and  if combined with COUNT is used to
 

How to call C header that is not provided generally by system in C++?

Headers can be called by using extern C Syntax of extern C is: extern "C" <function declaration> for example to call C functions from C++ we can write extern "C" { <function declaration> <function declaration> ...
 

How to define command line arguments

The main functions can have arguments passed which are called as command line arguments. There are two command line arguments: Argument count denoted by argc and Argument vector denoted by argv The argc is an integer variable which denotes the number of parameters passed and argv is pointer to a
 

SQL Table Commands

SQL Table Commands Overview As mentioned previously in this series of SQL articles, databases are primarily composed of tables. The “columns and rows” structure of the table allows data to be efficiently inserted, manipulated, updated, and deleted from the database. The three mos
 

System Implementation

In the previous articles relating to SDLC Stages we discussed about Project Planning and Feasibility Study moved on to System Analysis and Requirements which lead to Systems Design. Systems Design will naturally lead to another stage where it becomes closer to the actual deployment of the p
 

System Analysis and Requirements

In the previous chapter, we’ve discussed about project planning and feasibility study. That stage was important because it tries to establish a problem in our highly technological world. As our understanding on what we can do in computers evolve and so are the things that we need to make t
 

The Interview Snafu

How to turn someone else’s mistake to your advantage Your dream job is about to become reality. A recruiter gave you the heads up about the perfect position at Humungous Conglomerate, Inc. You went through five interviews as well as a battery of psychological tests mandated by their HR de
 

Sponsored Links

 




About Us  |   Privacy Policy  |   Terms and Conditions  |   Contact  |   Site Map  |   Add Question  |   Propose Category  |   RSS Feeds  |   Articles Sitemap  |   Site Updates  |   Add Resource

Copyright © 2005 - 2008 GeekInterview.com. All Rights Reserved
Page copy protected against web site content infringement by Copyscape