awk help

Hi,

I am facing one problem while using awk. I want to use if/else condition with awk and want ro redirect the output from if and else to separate files. COuld any one please suggest.

cat $file | awk -F"|" '{ if (length($7) < 8 ) print }' 

Thanks

---------- Post updated at 10:21 PM ---------- Previous update was at 10:14 PM ----------

Also I have to edit the 7th field. in few record the 7th field is wrong. I have correct 7th field in a separate file with one more unique field ie first field in the original file.

format

first_field|correct_7th field . How can i correct that 7th incorrect field

cat is not needed here. Its UUOC

awk '{ if ( $1 > 10 ) { print $0 >> file1 } else { print $0 >> file2 } }' inputfile