is it possible to print different lines to different output files using awk

awk

Solution

You need to close the file names in double quotes:

awk '{if($2>10) {print > "outfile1"} else {print > "outfile2"}}' infile

Problem

I want to print different lines to different output files using awk, depending on different conditions, like ``` awk '{if($2>10) print > outfile1; else print > outfile2}' infile ``` but this script doesn't work how to modify it? thanks!>

Original source