Problem count with wc-l command


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Problem count with wc-l command
# 1  
Old 02-27-2008
Problem count with wc-l command

Hi All,

I'm trying to count how many line in my *.txt file.
My *.txt file has 1937 lines.
The problem is : when I use wc -l command
the result is 1936.

Again, I did some test. I create a new file with 100 lines with text editor (Notepad ++, Ultra edit).
And when I count it again with wc -l command, the result is 99.

Could someone help me ?

Thanks
Albasit
# 2  
Old 02-27-2008
Erm, that shouldn't be happening. Can you open your file in 'vi' and see how many lines it has? The 'wc -l' command will count lines that have '\n' in them, so it won't generally report an incorrect count.
# 3  
Old 02-27-2008
hi blowtorch,

thanks for the reply.
Ooo...I see..
I did "vi" my text file, and it has 1937 lines.
So, to make wc -l worked right, I have to make one blank line after the end of line.
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Count Command Help

Hi Everyone, I'm new to unix scripting. Hoping you guys can help me out. I am trying to create a script that will do a count command for each file (in this example *.dat) within a predefined directory and display only the filename without the full path. This is what I got so far, but it... (10 Replies)
Discussion started by: kadawtomtom978
10 Replies

2. Shell Programming and Scripting

problem to count number of words from file

hi every one i have written this simple shell for counting number of word that user need to find from file but i have get several error when run it. can someone tell me the problem ? echo "Enter the file name" read file echo "enter word" read word for i in \`cat $file` do if then... (1 Reply)
Discussion started by: nimafire
1 Replies

3. Shell Programming and Scripting

Process count problem in script

Hi, I am trying to make a script which should execute if the same is not getting executed already. To implement this check, I wrote a fragment of code as below $ cat abc.sh #!/bin/bash check=0 #grepping "sh -x abc.sh" because if i check only for "abc.sh" and the file is open in say... (12 Replies)
Discussion started by: sam05121988
12 Replies

4. Shell Programming and Scripting

Loop renaming files w/ a count problem

:wall: Hello there, basically in my program where im stuck at is when it comes to rename the files in a loop. - the program counts the number of files w a given name (works!) - and then if the number of files is greater or equal to the MAX_VERSIONS (numbers of files allowed w the... (1 Reply)
Discussion started by: thurft
1 Replies

5. Shell Programming and Scripting

Perl code- word count problem

Hi, I am having .csv files contains some row - Info: Value of field name 'SecurityExchange' is not supported ","Original Order Tuple Please see the below perl code carefully- /Info: (+),Original (\w+) Tuple/ and do { ($category, $type) = ($1, $2); if($type eq 'Execution')... (1 Reply)
Discussion started by: pspriyanka
1 Replies

6. Shell Programming and Scripting

Awk Count Pattern problem.

I want to keep a count of a all the records processed in a input file. The input file would have a lot of data containing various information. Lets say I make a pattern that only prints out data with the amount $37.57. How would I go about keeping track of how many $37.57 appears? I have... (2 Replies)
Discussion started by: Boltftw
2 Replies

7. UNIX for Dummies Questions & Answers

Record count problem using sed command

Hi, I have a script which removes 2 header records and 1 trailer record in a list of files. The commands doing the actions are sed '1,2d' $file > tempfile1.dat sed '$d' < tempfile1.dat > $output.txt Its working fine for all records except a file having size=1445509814 and number of... (2 Replies)
Discussion started by: ayanbiswas
2 Replies

8. Shell Programming and Scripting

Complex file count problem

Hi all! I have a question regarding possibilities to do line counts. SEARCH_VAR=TEX rsh $REM_HOST -l $REM_USER "cd $REM_DIR; ls *$SEARCH_VAR* 2> /dev/null" | sort -n | awk 'BEGIN { FS = "-" } ; { print $1"\t"$0 }' Will produce an output on the screen like this: 483 483-SOME-TEXT-1... (1 Reply)
Discussion started by: bbergstrom74
1 Replies

9. UNIX for Dummies Questions & Answers

Word count problem

I have a text file that has 5719 rows when I open it up in a text editor. When I do a wc -l in Unix however, it says that I have 5718 rows. What could be causing this difference? (1 Reply)
Discussion started by: ssmith001
1 Replies

10. Shell Programming and Scripting

problem with count

Hi, consider this file "master" which contains data as 11:skjs:24:asd2 1:skdfjk:23:sfdf 12:su:25:jkh5 13:gre:22:kljl7 14:sai:34:kjg7 I am trying to enter data into the file "master" i want to count the number of times 11 is present in the file "master" that to in the first filed... (5 Replies)
Discussion started by: uni_ajay_r
5 Replies
Login or Register to Ask a Question