How to count how many lines a file have?

C

carbon333

Guest
You can do this by typing:

wc -l file.txt

Also if you want know the number of words or characters, type:

wc file.txt
 


----- text file. Click on Edit>Go To. Give a huge number than expected number of lines. say if you expect to have 2000 lines, give 5000 or just give 200000. It gives an eror "The Line number is beyond the total number of lines" and shows up the the immediately available line. If you have 2379 lines it gives 2380. So whatever it shows up minus 1 is the actual number of lines in the text file.
 
In vim you can see how many lines in line when you go to end file. Number lines and character in lines is display in down.
 
wc is cleaner, but I will also mention the following use of cat and tail (haha) because I use it a lot:
Code:
cat -n [I]file_name[/I]|tail -5

This will list out the last five lines of the file, with the lines numbered.
 

Members online


Latest posts

Top