搜索一个字符串并替换它

时间:2019-12-18 15:13:30

标签: powershell-3.0

Powershell的新手。

假设以下文本位于名为“ example.txt”的文件中。

------------
example.txt
------------
#   Chicago                9057
111111111111111111000000000111111111111
000020330000000009999993124442222224244
#
#
#   Michigan               7050
908798888888888888888888888222222222222
948781467463484635000558755551656666666
#
  • 如何编写脚本以打开此文件-example.txt并搜索“芝加哥”或“密歇根州”,并根据该内容-将数字“ 9057”或“ 7050”替换为“ 9059”或分别是“ 7051”?

    非常感谢您的帮助。 -谢谢, 马特

0 个答案:

没有答案