linux--more practical shell commands

Source: Internet
Author: User
1) Count the number of rows in the index.php file in the current directory

[[email protected]_web1 ~]# cat index.php |wc -l17

2) Statistics web directory, JS file number:

[[email protected]_web1 ~]# find web/ -name "*.js" |wc -l

3) Statistics web directory of all JS file code lines:

[[email protected]_web1 ~]# find web/ -name "*.js" |xargs cat|wc -l 或 wc -l `find web/ -name "*.js"`|tail -n1

4) Statistics web directory of all JS file code lines, filtered blank line:
' [[email protected]_web1 ~]# Find web/-name ' *.js ' |xargs cat|grep-v ^$|wc-l '

5) Count all the JS file code lines in the Web directory. Filter comment Lines
[[email protected]_web1 ~]# find web/ -name "*.js" |xargs cat|grep -v -e ^$ -e ^\s*\/\/.*$|wc -l

linux--more practical shell commands

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.