text-count-cli
v1.0.0
Published
A command-line tool for counting characters, words, sentences, and lines in text inputs or files.
Downloads
4
Maintainers
Readme
text-count-cli
cli tool to count the number of words,characters,sentences,line from a text or a file.
Installation:
npm install text-count-cli
Usage:
Counting Text Input
To count based on text input, use the following commands:
- To count characters:
count char "your text here"
- To count words:
count word "text"
- To count lines:
count line "text"
- To count sentences:
count sen "text"
Example:
count char "hi buddy how are you?" //output-21
count word "hi buddy how are you?" //output-5
count sen "hi buddy how are you?" //output-1
count line "hi buddy how are you?" //output-1
Counting Text from a File
To count based on a file, use the -f flag followed by the count type and the file path: When specifying file paths, if the file is in the root directory of your project, you can simply use the file name without the full path.
- To count words in a file:
count -f word path/to/your/file.txt
- To count characters in a file:
count -f char path/to/your/file.txt
- To count lines in a file:
count -f line path/to/your/file.txt
- To count sentences in a file:
count -f sen path/to/your/file.txt
Example:
count -f char suraj.txt //output-32
count -f word suraj.txt //output-6
count -f sen suraj.txt //output-1
count -f line suraj.txt //output-1