resetting value of a local variable
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)))
精彩评论