awk - output to file

How do I make my awk script write its output to a file?

awk -f script.awk inputfile > outputfile

Well... you just use the ">" sign in order to direct the output to an output file.

Pablo.

Thanks cordobapab , but I want to do it from within the script, is this possible?

BEGIN {
  out_file = "junk2"
  print "line 1" >out_file
  print "line 2" >out_file
}