首页 > 解决方案 > Replace lines containing special characters in Powershell

问题描述

I want to replace all lines containing TM_SPINDLE_OFF(3) with $(SPINDLE_OFF)(2) The file is an ASCII code file.

This is what I came up with without success:

powershell -command "(gc tr.cnc) -replace 'TM_SPINDLE_OFF(3)', '$(SPINDLE_OFF)(2)' 

标签: powershellcharacter

解决方案


try this:

(gc d:\tr.cnc) -replace 'TM_SPINDLE_OFF\(3\)', '$(SPINDLE_OFF)(2)'

推荐阅读