print to screen and to file using awk?!

Hello all!..

does anyone know the syntax to print to the screen and to a file?

Im using something like

AWK ....

     print header |tee -a invalid\_csv_file ;

END {..}
' invalid_csv_file="$invalid_csv_dir_file"
but no joy?

I get sh: 0c:/cygwin/home/satnam.bihal/sat/itg/bad/invalid_csv_recs.csv: No such file or directory error?

awk '{print $1}' myFile.txt | tee -a myOutputFile.txt

Hi tahnks for the feedback, but i dont think I explained it well enough... Within the main body of the awk script, I am trying to write a the contents of a variable called header to the screen and to the file, but within the main body of the script..not once the awk script has finished...

does this make sense so for example(to simplify my exisitinf script...

awk -F,  '\{ 
        ... other bits of code here..... 

        if \(invalid\_rec_count==1\) \{
            
            print "I cant get this to work :-\( " | tee -a invalid\_csv_file ;
            
        \}         
      \}
    else \{
        blah blah blah...            
    \}
 \} 
 \}
 ' invalid\_csv\_file="$invalid\_csv\_dir_file"  $data\_dir\_and_file

Its just the print bit that dosnt seem to work?

Kind Regards

Satnam