You're replying to a comment by Bhaskar.

Bhaskar Permalink
December 02, 2013, 11:48

Hi, I have an input file,and need to replace one number from that file with 4 different values (which is an array) and write output to 4 different files, the name of files are dynamically used from array (along with some fixed name).

for (i = 1; i <= 4; ++i){
if ( $2 == 200) $2 = arr[i]
print > filename[i];

however I am having problem that for loop is getting repeated for every single line it reads and finally it write only last value of array as replacement in all 4 files. I am executing this as an awk file.

Reply To This Comment

(why do I need your e-mail?)

(Your twitter handle, if you have one.)

Type the word "security_122": (just to make sure you're a human)

Please preview the comment before submitting to make sure it's OK.