I want to understand what the backslash represents in this command.
grep "\.900983" table
I know what the command does, it searches for the
900983 value in
table, I'm just not sure of the purpose of the \ or what it does.
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. It only takes a minute to sign up.Sign up to join this community
. is a regular expression metacharacter which matches any single character.
\ is also a regular expression metacharacter which can be used to escape any metacharacter so that it will be literally matched.
. matches any character, but
\. matches only
printf %c900983\\n a . | grep -n ".900983"
. regular expression metacharacter matches a literal
. or an
a or any other single character, but...
printf %c900983\\n a . | grep -n "\.900983"