

















Here is a great little application that does a find and replace on a particular 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]Options
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, locate the original_text string within the .txt file and change it to new_text. The -p switch means it won't actually change anything because this is a preview, showing you how many strings it found within each .txt file.
Example 2 (replace text)
fart -c -r -i *.txt original_text new_text
Same as above except 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.
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。