[Bug 226112] awk(1) man page unclear about field separator, FS
bugzilla-noreply at freebsd.org
bugzilla-noreply at freebsd.org
Sat Feb 24 20:41:05 UTC 2018
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=226112
Jamie Landeg-Jones <jamie at catflap.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |jamie at catflap.org
--- Comment #2 from Jamie Landeg-Jones <jamie at catflap.org> ---
Hi. Thanks for the reply.
I'll explain how I got here:
I wanted to do a quick hack to split a line at every character, and at that
point, I was not familiar with "awk" allowing a null character to do the job.
Hence, believing the strings was a regular expression, I set FS to "." which -
contrary to the manual - was taken as a literal, not a RE!
Indeed, in your description of the atom from re_format, you missed out:
"or a single character with no other significance (matching that character)."
As in your examples: You used examples where a single character is already a
literal character in RE, which isn't always the case:
% printf 'hello(world' | egrep '('
egrep: Unmatched ( or \(
% printf 'hello(world' | awk -F '(' '{print $1}'
hello
I know this is hardly a major error, but it is still inaccurate - especially in
the case of "."!
Just for info, the actual text from gawk (which probably phrases it better than
I did!) is:
"If FS is a single character, fields are separated by that character. If FS is
the null string, then each individual character becomes a separate field.
Otherwise, FS is expected to be a full regular expression."
Cheers, Jamie
--
You are receiving this mail because:
You are the assignee for the bug.
More information about the freebsd-doc
mailing list