{
if($0 != "42")
print $0
else
exit
}
And another alternative solution:
/42/{exit}
{print $0}
created
last reply
- 5
replies
- 1.3k
views
- 5
users
{
if($0 != "42")
print $0
else
exit
}
And another alternative solution:
/42/{exit}
{print $0}
Initially, i thought
[color=#FF0000]NR<2,/42/[/color]
to be the shortest AWK code but then found that it stops "after" printing 42.
I wonder what the 9-byte accepted code looks like...
EDIT: Turns out the input file is already known and the number preceding 42 is 19. So, here goes...
[color=#FF0000]NR<2,/19/[/color]
or even better with 5-byte code..
[color=#FF0000]NR<38[/color]