Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

add newline before exiting

10 views
Skip to first unread message

TonyG

unread,
Jan 8, 2012, 11:58:26 PM1/8/12
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
}
}

NBaH

unread,
Jan 13, 2012, 10:29:04 AM1/13/12
to
Hi,

Did you try simple
if($9 > 3.0){ print ""; exit }
?
0 new messages