【发布时间】:2012-03-24 01:52:16
【问题描述】:
我有以下情况。
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 时,它工作得很好,但在循环中它没有取值。
我很乐意接受这些建议。
【问题讨论】:
-
@kev 这是一个逻辑错误,而不是语法错误。我的意思是说,它对这个命令没有任何作用。
标签: linux parsing loops indices