Windows Command Line find and replace-made easy with fart.exe

Source: Internet
Author: User
Windows Command Line find and replace-made easy with fart.exe here is a great little application that does a find and replace on a particle file, file type or file contents, then replaces it with a string of your choice. it can look in sub directories as well.
The small app is called fart, yes that's right fart-find and replace text!

Usage: fart [Options] [--][,...] [Find_string] [replace_string]

  • -H,-help show this help message (ignores other options)
  • -Q,-Quiet suppress output to stdio/stderr
  • -V,-verbose show more information
  • -R,-recursive process Sub-folders recursively
  • -C,-count only show filenames, match counts and totals
  • -I,-ignore-case insensitive text comparison
  • -V,-invert print lines not containing the find string
  • -N,-line-Number Print line number before each line (1-based)
  • -W,-word match Whole word (uses C syntax, like grep)
  • -F,-filename find (and replace) filename instead of contents
  • -B,-binary also search (and replace) in binary files (caution)
  • -C,-C-style allow C-style extended characters (\ xFF \ t \ n \ r \ etc .)
  • -CVS skip CVS dirs; execute "CVS edit" before changing files
  • -SVN skip SVN dirs
  • -Remove remove all occurences of the find_string
  • -A,-adapt the case of replace_string to found string
  • -B,-Backup make a backup of each changed File
  • -P,-preview do not change the files but print the changes

Example 1(Replace text, preview only)

Fart-c-r-I-p *. txt original_text new_text

This will look for all. txt files in a sub directory, locateOriginal_textString within the. txt file and change itNew_text. The-P switch means it won't actually change anything because this is a preview, showing you how to adjust strings it found within each. txt file.

Example 2(Replace text)

Fart-c-r-I *. txt original_text new_text

Same as above should t it will do the actual replacement.

Example 3(Remove text)

Fart-r-I -- remove *. txt "remove this text"

Rather than replacing one term for another this will remove the specified term.

Note: use quotes around text if it contains spaces, tabs, etc.

Download fart from SourceForge.

Alibaba Cloud Hot Products

Elastic Compute Service (ECS) Dedicated Host (DDH) ApsaraDB RDS for MySQL (RDS) ApsaraDB for PolarDB(PolarDB) AnalyticDB for PostgreSQL (ADB for PG)
AnalyticDB for MySQL(ADB for MySQL) Data Transmission Service (DTS) Server Load Balancer (SLB) Global Accelerator (GA) Cloud Enterprise Network (CEN)
Object Storage Service (OSS) Content Delivery Network (CDN) Short Message Service (SMS) Container Service for Kubernetes (ACK) Data Lake Analytics (DLA)

ApsaraDB for Redis (Redis)

ApsaraDB for MongoDB (MongoDB) NAT Gateway VPN Gateway Cloud Firewall
Anti-DDoS Web Application Firewall (WAF) Log Service DataWorks MaxCompute
Elastic MapReduce (EMR) Elasticsearch

Alibaba Cloud Free Trail

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: 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.