The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
Google UNIX.COM


Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Number of lines in a file (perl script) jisha Shell Programming and Scripting 5 05-20-2008 04:11 AM
total number of lines in a file Raynon Shell Programming and Scripting 9 10-04-2007 06:13 AM
cut a number of lines out of a file networkfre@k Shell Programming and Scripting 1 12-08-2005 09:46 PM
Count number of lines in Binary file vanand420 Shell Programming and Scripting 3 09-04-2005 10:07 PM
Need ls to show number of lines in each file GMMike UNIX for Dummies Questions & Answers 1 11-19-2004 01:53 AM

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 12-19-2007
Registered User
 

Join Date: Nov 2007
Posts: 4
How to find number of lines in a file

Hi

How do I find number of lines of a file? Below commands returned 0. But, the file is showing 20 lines when I open it in editplus tool. Each line contains 601 columns. Please advise

I want to incorporate some word at the begining of each of those 20 lines

-Somesh


$ wc -l < ./somesh_test
0
$ cat ./somesh_test |wc -l
0
$ ls -ltr somesh_test
-rw-r--r-- 1 edwapps edw 11419 Dec 19 16:07 somesh_test
$ file somesh_test
somesh_test: ascii text
Reply With Quote
Forum Sponsor
  #2 (permalink)  
Old 12-19-2007
Registered User
 

Join Date: Dec 2007
Posts: 1
just type

wc -l somesh_test
Reply With Quote
  #3 (permalink)  
Old 12-19-2007
Smiling Dragon's Avatar
Disorganised User
 
Join Date: Nov 2007
Location: New Zealand
Posts: 640
I suspect it's one line without an end of line character at the end.
What happens if you run it through head -1? Do you get the whole thing?
Also try wc (without the -l).
Reply With Quote
Google UNIX.COM
Reply

Thread Tools
Display Modes




All times are GMT -7. The time now is 03:50 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008 The CEP Blog All Rights Reserved -Ad Management by RedTyger Visit The Global Fact Book

Content Relevant URLs by vBSEO 3.2.0