powershell - 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)'
解决方案
try this:
(gc d:\tr.cnc) -replace 'TM_SPINDLE_OFF\(3\)', '$(SPINDLE_OFF)(2)'
推荐阅读
- go - 为什么在我的 Go 代码中忽略 MinVersion 标志?
- swift - 值转换后如何使用自定义 SwiftUI 绑定的 Setter
- scala - 如何使父类返回可以匹配子类型的类型?
- java - 为什么敌人的健康停止重置
- java - 如何使用 AbstractReactiveMongoConfiguration 连接到两个 Mongo 存储库
- matlab - MATLAB R2015a,将函数作为参数传递
- haskell - 使用镜头映射记录的两个字段
- r - R 使用 Dplyr 创建一个列,该列包含基于 5 个其他列的值的 6 个可能值中的 1 个
- ruby - 如何在一行中获得多个N输入
- javascript - 识别从反应代码中的多个复选框检查的输入并将它们存储在一个空数组中