Project

General

Profile

Bug #3764

Semantic of nawk's print statement changed

Added by David Höppner over 6 years ago.

Status:
New
Priority:
Normal
Assignee:
-
Category:
cmd - userland programs
Start date:
2013-05-06
Due date:
% Done:

0%

Estimated time:
Difficulty:
Medium
Tags:
needs-triage

Description

Old nawk:

$ echo "THIS" | nawk 'END {print}'

$

Newer nawk and gawk:

$ echo "THIS" | nawk 'END {print}'
THIS
$

We should use print ""

This is a problem in files as
http://src.illumos.org/source/xref/illumos-gate/usr/src/lib/libxcurses/src/libc/xcurses/mkterm.awk

A plain print outputs unmatched comment lines with newer nawk versions.

The simple statement ‘print’ with no items is equivalent to ‘print $0’: it prints the entire current record. To print a blank line, use ‘print ""’, where "" is the empty string.

http://www.gnu.org/software/gawk/manual/html_node/Print.html

Also available in: Atom PDF