how to include field in the output filename of awk

Im using awk and I want the output filename to contain the first field of the input file.
Ex.

1 dddd wwwww
1 eeeee wwww
1 wwww eerrrr
2 eeee eeeeee

I want the output files to be xxx1 and xxx2

Thank you

what data you want in xxx1 file and in xxx2 file??

You can do something like that :

awk '{ print $2,$3 > "xxx" $1 }' inputfile

Jean-Pierre.


awk '{ ofile=sprintf("xxx%d", $1)
      print $0 > ofile } ' inputfile

thank you... very helpful :b: