On this website it says:
[[:blank:]] space and tab characters
[[:space:]] whitespace characters
What's the difference between space and tab characters and whitespace characters? To me, they almost seem the same.
On this website it says:
[[:blank:]] space and tab characters
[[:space:]] whitespace characters
What's the difference between space and tab characters and whitespace characters? To me, they almost seem the same.
The [[:space:]]
class is a superset of [[:blank:]]
which additionally (apart from the space and tab of [[:blank:]]
) includes
\n
, line feed on Unix, ASCII code 10),\v
, ASCII code 11),\f
, ASCII code 12), and\r
, ASCII code 13).... in the POSIX locale, that is. Other locales may have additional space characters.
[[:blank:]]
is horizontal spacing characters only while[[:space:]]
contains all horizontal and vertical spacing characters. See also\h
vs\s
inperl
regular expressions. – Stéphane Chazelas Mar 20 '17 at 16:23\r
a vertical spacing character? – Kusalananda Mar 20 '17 at 16:25[[:space:]]
characters in the POSIX locale are all control characters, so the behaviour will vary with the device they are sent to. CR moves the cursor/carriage back to the start of the screen/page so on its own is not really a vertical spacing character, but it's part of the CRLF sequence that is sent to ttys for a line-break so as such can be seen as vertical spacing. – Stéphane Chazelas Mar 20 '17 at 16:35[[:space:]]
to be a superset of[[:blank:]]
(in any locale). http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap07.html – Stéphane Chazelas Mar 20 '17 at 16:37