开发者

resetting value of a local variable

开发者 https://www.devze.com 2023-02-15 00:24 出处:网络
I am using a local variable record in a for loop like record=$(awk \'NF!=4 {print $0}\' n20${i}) but everytime instead of taking a new value it appends last value to new value. How can I solve my p

I am using a local variable record in a for loop like

record=$(awk 'NF!=4 {print $0}' n20${i})

but everytime instead of taking a new value it appends last value to new value. How can I solve my problem? Thanks in adv开发者_JS百科ance.


record=$(awk 'NF!=4 {print $0}' n20$((i++)))

That will increment the value of i each time the line is executed.

Or if you just want i+1 without changing the value of i:

record=$(awk 'NF!=4 {print $0}' n20$((i+1)))
0

精彩评论

暂无评论...
验证码 换一张
取 消