原文:
bottom: 'conv1_1/3x3'
top: 'conv2_1/4x4'
替换得到
bottom: 'conv1_2/3x3'
top: 'conv2_2/4x4'
我写的脚本是这样的:
awk '{if( (match($0, "bottom") && match($0, "_1/")) or (match($0, "top") && match($0, "_1/")) ) {print $0 "\n" gsub("\_1\/", "\_2\/");} else {print "1";} }' step1.prototxt
但是最后的结果不太对,有很多的零,很奇怪这样的结果。哪里不对,或者朋友们有没有更简单明了的写法。
1
czheo 2017-10-24 16:20:23 +08:00
>> awk '{gsub("_.", "_2", $0); print $0}' test.txt
但是 sed 显然比较方便啊 >> sed 's/_./_2/' test.txt |