我有以下情况。
awk '$0 != "Force for tool binder" # print all lines until string found
$0 =="Force for tool binder"{
print ; getline ; print; # go to 2 lines below the string
getline; getline < " forceState$j.k "; print}' dynaFile_Offen1.k > tempDynaFile.k # take the string from
#the file forceStates$j.k and replace in the main file, generating a temp file.
问题是这里的 j 是一个循环索引,这意味着对于第一种情况它是 j=1。当我将它用作 forceStates1.k 时,它工作得很好,但在循环中它没有取值。
我将不得不接受这些建议。