I understand that special characters generate special actions:
$ echo 'abc[abc' | grep -o '['
grep: Invalid regular expression
Note that single quotes avoid issues with shell interpretation or change of the source string.
I also understand that a backslash is needed to escape that special interpretation of those special characters:
$ echo abc[abc | grep -o '\['
[
And that to match a backslash-specialChar (\[) grep needs even more backslashes:
$ echo 'abc\[abc' | grep -o '\\\['
\[
But a simple character as an f is not special and matching a \f should need no additional escape:
$ echo 'abc\fabc' | grep -o '\f'
f
But it does:
$ echo 'abc\fabc' | grep -o '\\f'
\f
A literal string, as in:
$ echo 'abc\fabc' | grep -F -o '\f'
\f
Goes to prove that the \f is being interpreted in some way by grep.
The manual states:
The ‘\’ character, when followed by certain ordinary characters, takes a special meaning:
/s
Match white space, it is a synonym for ‘[[:space:]]’.
The certain ordinary characters imply that there are other ordinary characters that are not in that list and that have no special status.
Therefore, it is my understanding that a \f (just to pick one character) should match a source string of \f.
What am I missing?
Related:
2- Escaping slash “\” in grep.
3- Why does sed require 3 backslashes for a regular backslash?.