Subject: problem with NetBSD awk
To: None <tech-userlevel@NetBSD.org>
From: Aleksey Cheusov <cheusov@tut.by>
List: tech-userlevel
Date: 04/22/2006 20:47:24
Hi all.
Can anybody explain me this?

0 ~>/usr/pkg/bin/gawk -v nls="`printf 'a\nb\n'`" 'BEGIN { print nls }'
a
b
0 ~>/usr/pkg/bin/mawk -v nls="`printf 'a\nb\n'`" 'BEGIN { print nls }'
a
b
0 ~>/usr/bin/awk -v nls="`printf 'a\nb\n'`" 'BEGIN { print nls }'
/usr/bin/awk: newline in string a
b... at source line 1
2 ~>

All three awk implementation works the same way with the following command
/usr/bin/awk -v nls='a\nb\n' 'BEGIN { print nls }'

susv3 says the following
    -v  assignment
        The application shall ensure that the assignment argument is in the
        same form as an assignment operand. The specified variable assignment
        shall occur prior to executing the awk program, including the actions
        associated with BEGIN patterns (if any). Multiple occurrences of this
        option can be specified.

-- 
Best regards, Aleksey Cheusov.