English 中文(简体)
简单Batch搜索与替换
原标题:Simple Batch Search & Replace Script

我很短时间,并期待着建立一个非常简单的文字,以便:

1) Rename a string within another file in the same directory (name of file is known) Example: Replace "[replace_me_with_path_to_second_file]" with "current_working_directory/second_file.txt" in first_file.txt

2) Open/Execute that file “first_file.txt”

3) 关闭

提前感谢!

问题回答

如果你对定期表达感到安慰的话,这是一件完美的工作。 经常使用或作为表达方式与其替代之间的界限,因此,你应当避免在档案中的任何冲突。 举例说:

sed -i  s/replace_me_with_path_to_second_file/current_working_directory/second_file.txt/  first_file.txt




相关问题
complex batch replacement linux

I m trying to do some batch replacement for/with a fairly complex pattern So far I find the pattern as: find ( -name *.php -o -name *.html ) -exec grep -i -n hello {} + The string I want ...

How to split a string by spaces in a Windows batch file?

Suppose I have a string "AAA BBB CCC DDD EEE FFF". How can I split the string and retrieve the nth substring, in a batch file? The equivalent in C# would be "AAA BBB CCC DDD EEE FFF".Split()[n]

How to check which Operating System?

How can I check OS version in a batch file or through a vbs in an Windows 2k/2k3 environment ? You know ... Something like ... : "If winver Win2k then ... or if winver Win2k3 then ....

热门标签