GNU bug report logs - #33972
grep -vf <(<nothing>) filters all rows

Previous Next

Package: grep;

Reported by: luke <at> gavelfamily.com

Date: Fri, 4 Jan 2019 05:16:02 UTC

Severity: normal

Done: Paul Eggert <eggert <at> cs.ucla.edu>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: luke <at> gavelfamily.com
To: 33972 <at> debbugs.gnu.org
Subject: bug#33972: grep -vf <(<nothing>) filters all rows
Date: Fri, 4 Jan 2019 00:04:28 -0500
[Message part 1 (text/plain, inline)]


I have to pre-check for an empty set before passing it to grep:
�
SAVED_RECORDs=($(sqlite3 -list -separator '/' files.db "SELECT FileName FROM Files WHERE ModTime > '2018-12-31'")) #Returns an empty set
NEW_RECs=($(ls * | grep -vf <(echo ${SAVED_RECORDs[@]}
| tr ' ' '\n') #Returns an empty list because grep considers SAVED_RECORDs to be universal rather than null set
Workaround:


if [ ${#SAVED_RECORDs[@]} -gt 0 ]; then

� NEW_RECs=($(ls * | grep -vf <(echo ${SAVED_RECORDs[@]} | tr ' ' '\n') #Now returns the expected subtraction of SAVED_RECORDs from NEW_RECs

fi
[Message part 2 (text/html, inline)]

This bug report was last modified 5 years and 194 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.