Skip to content

Instantly share code, notes, and snippets.

@sparr
Last active December 21, 2015 09:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sparr/6287686 to your computer and use it in GitHub Desktop.
Save sparr/6287686 to your computer and use it in GitHub Desktop.
testing gnu grep 2.5.1 for matching leading unescaped curly braces
sparr$ grep --version
grep (GNU grep) 2.5.1
Copyright 1988, 1992-1999, 2000, 2001 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
sparr$ echo "foo { bar" | grep "{"
foo { bar
sparr$ echo "foo { bar" | grep -E "{"
foo { bar
sparr$ echo "foo { bar" | grep -E "\{"
foo { bar
sparr$ echo "foo { bar" | grep -o "{"
{
sparr$ echo "foo { bar" | grep -Eo "{"
{
sparr$ echo "foo { bar" | grep -Eo "\{"
{
sparr$ echo "foo { bar" | grep -o "{" | wc
1 1 2
sparr$ echo "foo { bar" | grep -Eo "{" | wc
1 1 2
sparr$ echo "foo { bar" | grep -Eo "\{" | wc
1 1 2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment