This is the mail archive of the cygwin mailing list for the Cygwin project.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
Other format: | [Raw text] |
In the latest release of grep (2.5.1a-2), I believe that the -f option (read expressions from a file) is no longer working. This option is documented as follows: -f FILE, --file=FILE Obtain patterns from FILE, one per line. The empty file con- tains zero patterns, and therefore matches nothing. However, it appears that no match of any input is ever found for any set of strings in the file specified by -f. This functionality was working in an earlier release (I regret to say that I cannot remember the last time it was working but it was a release within the last year, I think). I have included two example scripts that illustrate the problem: -----grepgood----- ( echo $BASH; cat <<XXX ) | AAAAAA BBBBBB CCCCCC XXX grep $1 -e "AAAAAA" -e "BBBBBB" -e "CCCCCC" ------------------- The first script, grepgood, shows the expected behavior. It uses explicit expression on the command line instead of using the -f option. Examples of expected behavior: $ ./grepfbug AAAAAA BBBBBB CCCCCC $ ./grepfbug -v /usr/bin/sh Note: the second invocation uses the grep -v option to show the difference between finding and not finding correctly the specified expressions. The second script, grepfbug, illustrates the problem. This script uses itself as the source of the expressions to match but still finds nothing. -----grepfbug----- ( echo $BASH; cat <<XXX ) | AAAAAA BBBBBB CCCCCC XXX grep $1 -f $0 ------------------- Examples of unexpected/errant behavior: $ ./grepfbug $ ./grepfbug -v /usr/bin/sh AAAAAA BBBBBB CCCCCC A work-around for the problem is to use sed to turn the contents of the file into -e options for grep: $ grep `sed -e "s/^/-e /" exressions.txt` * Thanks, Chris Milam
Attachment:
cygcheck.out
Description: cygcheck.out
-- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Problem reports: http://cygwin.com/problems.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |