Reference number: CH000820
What's an easy way to get a line count or other stats of a file?
Question:What's an easy way to get a line count or other stats of a file?
Answer:Microsoft Windows users
Microsoft Word
Users who have Microsoft Word installed on their computer can easily and quickly view statistics, such as the amount of pages, paragraphs, lines, words, characters, and characters with spaces, by following the below steps.
- Open Microsoft Word.
- Click File at the top of the Window.
- Click Properties.
- In the Properties window, click the Statistics tab.
WordPerfect
Users who have Corel WordPerfect installed on their computer can easily and quickly view statistics, such as characters, words, sentences, lines, paragraphs, pages, and other averages of the page by following the below steps.
- Open WordPerfect.
- Click File at the top of the Window.
- Click Properties.
- In the Properties window, click the Information tab.
OpenOffice Writer
If you have OpenOffice installed on your computer, it too can display a lot of statistics about a file. See our below Linux / Unix users OpenOffice section for steps on doing this.
In addition to the above suggestions, there are thousands of different text editors available on the Internet, many of them capable of displaying the statistics of a file.
MS-DOS users
Below is a listing of different methods of getting statistic information on files while in MS-DOS.
Find command
Using the below find command would list every line that does not contain "&*fake&*", which in every case is not found. Because this command is listing each line that does not contain this string of text you'd get an accurate listing of how many lines of text are in the file.
find /v /c "&*fake&*" programs.txt
Edit
Although very limited, the edit command is capable of displaying the amount of lines in a file. To do this, follow the below steps.
- Edit the file you wish to view the amount of lines in.
- Go to the end of the file. If the file is a large file, you can quickly get to the end of the file by pressing CTRL + END on your keyboard.
- Once at the end of the file the Line: in the status bar will display the line number.
In addition to the above recommendations, there are several third-party MS-DOS utilities designed specifically to count the amount of lines in a file and get other statistics. Click here to open a external search for these utilities.
Linux / Unix users
OpenOffice Writer
Users who have OpenOffice installed on their computer can easily and quickly view statistics, such as the number of pages, tables, graphics, OLE objects, paragraphs, words, characters, and lines, by following the below steps.
- Open OpenOffice Writer.
- Click File at the top of the Window.
- Click Properties.
- In the Properties window, click the Statistics tab.
From the command line, users have several different ways to count and get statistics about files on their computer. Below are a few examples.
wc command - The wc, or word count, command is one of the easiest and fastest methods of getting the amount of characters, lines, and words in a file. See this page for additional information and examples of this command.
pico command - Although limited, running the pico command and displaying your current position can give you line and character information. If you're wanting to see how many lines are in a file, go to the end of the document and press CTRL + C or ^C to get the current position.
vi command / vim command - The vi and vim and its variants are also capable of displaying line and character counts.
In addition to the above commands, users can write shell scripts, Perl scripts, and/or any other type of scripts or programs to get any details about the file they wish.
|