Commands for counting the number of rows under Windows

Source: Internet
Author: User

We all know that in Linux, the number of text lines can be wc-l command, for example:

-bash-3.2$ Cat Pif_install.log | Wc-l
712

But how to count the number of lines of output text under Windows, the answer is to use the FIND/C command

1. Count The number of rows that contain a string . For example, the number of time_wait when a network connection is counted

Netstat-an | find/i/C "Time_wait"

Here the/I parameter is case-insensitive, and the/C parameter is a count of the number of rows or records that contain the "time_wait" string.

2. Count all rows . Find has an option./C, which means the number of rows that do not contain a string, which can be used to count the number of lines of text, for example:

C:\users\nr>type Test.txt | find/v/C ""
253

Note: Empty lines in the file are counted correctly in addition to the last blank line, and the remaining empty rows are statistically correct.


Commands for counting the number of rows under Windows

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.