BEGIN{ while ( (getline < "junk.dat") > 0 ) { if (match($0,"-------") != 0) { r = rand(); } printf("%11.8f %s \n", r, $0) > "junk2.dat"; } }