[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
grep
From: |
Gerald S Stoller |
Subject: |
grep |
Date: |
Mon, 22 Sep 2003 14:21:41 -0400 |
FreeBSD 4.3-RELEASE FreeBSD 4.3-RELEASE #0: Sat Apr 21 10:54:49 GMT 2001
address@hidden:/usr/src/sys/compile/GENERIC i386
Above is the 'uname -a' from my machine. Below is a script
illustrating
the problem. I believe (according to my understanding of the grep man
page)
that the grep line output is correct but that the grep -w line output
is
incorrect, it should be just the first two lines of the grep output.
In vi , if the cursor is on the first "(" of a string beginning with
"((",
the w movement command causes the cursor to move past the second "(",
so vi considers adjacent (open) parentheses to combine and form a word.
I found that adjacent punctuation characters (all the graphic characters
from
the keyboard except for the alphanumerics) also combine to form a word.
Script started on Thu Sep 18 16:59:58 2003
0-$ echo "fgh( hkjh\nfgh(hkjh\nfgh((hkjh" | grep -w "fgh("
fgh( hkjh
fgh((hkjh
0-$ echo "fgh( hkjh\nfgh(hkjh\nfgh((hkjh" | grep "fgh("
fgh( hkjh
fgh(hkjh
fgh((hkjh
0-$ ^D Script done on Thu Sep 18 17:01:14 2003
In addition, in the grep command's pattern string, the man page
(in FreeBSD ) says that the characters '?', '+', and '*' are
naturally metacharacters. However, in practice I found that '+'
must have a preceding backlash to be viewed as a metacharacter.
In egrep use, though, I find how it views "+" & "\+" to be
reversed from their handling in grep . Do you really want such
inconsistent behavior?
- grep,
Gerald S Stoller <=