TonyG
unread,Jan 8, 2012, 11:58:26 PM1/8/12You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to
I use a simple script to calculate a derivative which exits when Y
value is >3.0. I'd like to add a newline to the file before the
program exits, but I can't get it right. I've tried to add { print
\n } before exit on line 10 and all kinds of its variants, but without
success...
BEGIN { firstline = 1 }
$0 !~ /^[A-Z]/ { if (firstline == 1) {
old_x = $9
old_y = $6
firstline = 0
}
else
{
print $1, (old_x + $9)/2.0, (old_y - $6)/(old_x - $9 + 0.000001 )
if ( $9 > 3.0 ) exit
old_x = $9
old_y = $6
}
}