Doscommand findstr and FC

Source: Internet
Author: User

In the process of analyzing or writing code, you often need to search for strings in the file or compare the two files. Common commands in Linux are grep and diff. Windows files have good open-source tools, such as winmerge. Searching for strings in files is unclear whether there are good open-source tools. Recently, we found that Windows has a doscommand to meet your needs.


Findstr: Search for strings in the file.

/S searches for matched files in the current directory and all subdirectories.

/C: String uses the specified string as the text search string.


<B> examples </B>

01:
Findstr "computer help" myfile.txt
Output the line containing the computer or help string in myfile.txt to the DOS console.


02:
Findstr/s "computer help" *. txt
Similar to the preceding example, search for strings containing computer and help in the current directory and subdirectory TXT files.


03:
Findstr/S/C: "computer help" *. txt
Find the string containing "computer help" in the current directory and subdirectory TXT file.



FC: Compare the differences between two files or file Sets

<B> examples </B>

FC file1 file2

Doscommand findstr and FC

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.