trisha-word-counter
v1.0.1
Published
A CLI tool to count occurrences of a word in a text file
Readme
Trisha Word Counter
A simple command-line tool (CLI) built with Node.js to count the occurrences of a specific word in a text file. The search is case-insensitive.
Features
- Count the occurrences of any word in a text file.
- Case-insensitive search.
- Easy to use from the command line.
- Can be executed directly using
npx.
Installation
You can run the package without installing it:
npx trisha-word-counter <file-path> <word>Or install it globally:
npm install -g trisha-word-counterThen use:
trisha-word-counter <file-path> <word>Usage
Example
Suppose file-1.txt contains:
Hello world
hello Node.js
HELLO everyoneRun:
trisha-word-counter file-1.txt helloOutput:
"hello" appears 3 times.How It Works
The program:
- Reads the file path from the command line.
- Reads the word to search.
- Converts both the file content and search word to lowercase.
- Counts the occurrences.
- Displays the total count.
Technologies Used
- Node.js
- JavaScript (ES Modules)
- npm CLI
Author
Trisha Singh
License
MIT
