[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
unexpected results for: grep -oi
From: |
Ferdinand Beljaars |
Subject: |
unexpected results for: grep -oi |
Date: |
Fri, 05 Jul 2002 13:47:06 +0200 |
User-agent: |
KMail/1.4.1 |
Hello,
I ran into some unexpected behaviour for GNU grep version 2.5.1 when combining
option -o and -i.
If I have read the manual page well, option -o is supposed to make grep print
only the matching pattern(s) for some matching expression in the input. When
adding option -i I would expect this to happen whatever case the expression
and input happen to be in.
Three illustrative examples from a shell command line:
1)
> echo "
line one
Line Two
line three
line four" | grep -io line
gives:
line
line
line
>
2)
> echo "
line one
Line Two
line three
line four" | grep -io Line
gives:
Line
>
What is really going on becomes more clear when adding option -n
3)
> echo "
line one
Line Two
line three
line four" | grep -ion Line
gives:
2:3:Line
4:5:>
All lines indeed have a matching pattern due to -i which is confirmed with -n,
but grep clearly fails to print the matching pattern and even a newline
character for all non exact matches.
This gives unpredictable and unusable results.
with kind regards,
Ferdinand Beljaars
address@hidden
- unexpected results for: grep -oi,
Ferdinand Beljaars <=