Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 24 Feb 2018 20:41:03 +0000
From:      bugzilla-noreply@freebsd.org
To:        freebsd-doc@FreeBSD.org
Subject:   [Bug 226112] awk(1) man page unclear about field separator, FS
Message-ID:  <bug-226112-9-Yq4e8ngwly@https.bugs.freebsd.org/bugzilla/>
In-Reply-To: <bug-226112-9@https.bugs.freebsd.org/bugzilla/>
References:  <bug-226112-9@https.bugs.freebsd.org/bugzilla/>

next in thread | previous in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D226112

Jamie Landeg-Jones <jamie@catflap.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jamie@catflap.org

--- Comment #2 from Jamie Landeg-Jones <jamie@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 jo=
b.

Hence, believing the strings was a regular expression, I set FS to "." whic=
h -
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 - especiall=
y 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 F=
S is
the null string, then each individual character becomes a separate field.=20
Otherwise, FS is expected to be a full regular expression."

Cheers, Jamie

--=20
You are receiving this mail because:
You are the assignee for the bug.=



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-226112-9-Yq4e8ngwly>