~ cat test.txt
12
13
13
13
13
13 13
13
13
13
~ seq 14 1 20 | while read var;do awk '/13/{c++;if(c==2){gsub("13",'"${var}"');}}1' test.txt > test.tmp && mv test.tmp test.txt ;done
~ cat test.txt
12
13
14
15
16
17 17
18
19
20
~ cat test.txt
12
13
13
13
13
13 13
13
13
13
~ seq 14 1 20 | while read var;do awk '/13/{c++;if(c==2){gsub("13",'"${var}"');}}1' test.txt > test.tmp && mv test.tmp test.txt ;done
~ cat test.txt
12
13
14
15
16
17 17
18
19
20