Code Monkey home page Code Monkey logo

countlines's Introduction

countLines

Just a bash script to count lines in specific folders

Usage

Suppose you have a project folder called myProject :

[user@localhost myProject]$ tree
.
├── dist
│   └── index.js
├── nodes_modules
│   └── array-equal
│       ├── component.json
│       ├── index.js
│       ├── LICENSE
│       ├── package.json
│       └── README.md
├── src
│   └── index.js
└── test
    └── index.test.js

To get the total lines of all files in src and test folders, just run :

[user@localhost myProject]$ countLines.sh src test
Project name: myProject
Total for all folders: 614

To obtain detail of files, just change the TO_PRINT settings to "TRUE", you can also use this tip to change it in one line command :

# if FALSE
sed -i 's/FALSE/TRUE/g' countLines.sh
# if TRUE
sed -i 's/TRUE/FALSE/g' countLines.sh

If you run the same command with true :

[user@localhost myProject]$ countLines.sh src test
Project name: myProject
Folder : src
src/index.js: 256
Total for src : 256
Folder : test
test/index.test.js: 358
Total for test : 358
Total for all folders: 614

You can copy this script to /usr/bin to have access to it everywhere.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.