Skip to content

jpkraemer/multiCounter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Multi Counter

Multi Counter is a simple commandline app to count certain lines in text files. For example, if you have a folder full of logs and are interested in, say, three different types of log statements that you need to count, Multi Counter is for you.

Installation

npm install -g multi-counter

Usage

Start by multiCounter some/log/dir. It will output something like this:

some/log/dir/1.txt
    All Lines: 9
some/log/dir/2.txt
    All Lines: 41
some/log/dir/3.txt
    All Lines: 57
some/log/dir/4.txt
    All Lines: 49

It becomes way more interesting when a config file is provided: multiCounter some/log/dir -c config.json.

The config file is a JSON-formatted config that looks like this:

{
    "patterns": [
        {
            "name": "Number of single line comments",
            "pattern": "^\\s*//"
        }
    ], 
    "depth": 1,
    "filePattern": "\\.log$"
}

MultiCounter will output how often every specified pattern occurred. If the filePattern option is specified, only files matching this regular expression will be counted. The depth option specifies how many directory levels will be traversed. It can be overridden by passing the --depth option to multiCounter.

About

Multi Counter is a flexible app for counting certain types of lines in text files.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published