【发布时间】:2019-04-21 06:06:35
【问题描述】:
我试图找出我做错了什么。
test="This is a test"
mytest=$(awk -v test="${test}" 'BEGIN{gsub("This is","This is not",test)}')
printf "My Test = $mytest\n"
这是更大的事情的一部分,但我试图理解为什么我不能让它工作。 $mytest 是空的。最终我想正则表达式/这是一个测试/但我什至无法让这个简单的工作。它没有出错。
【问题讨论】:
-
mytest="${test/This is/This is not}"
标签: regex bash awk replace gsub