I am removing stop words from a text, roughly using this code
I have the following
$ cat file
file
types
extensions
$ cat stopwords
i
file
types
grep -vwFf stopwords file
I am expecting the result:
extensions
but I get the ( I think incorrect)
file
extensions
It is as if the word file has been skipped in the stopwords file.
Now here's the cool bit: if I modify the stopwords file, by changing the single word/letter i on the first line, to any other ascii letter apart from f, i, l, e, then the same grep command gives me a different and correct result of extensions.
What is going on here and how do I fix it?
I'm using grep (BSD grep) 2.5.1-FreeBSD on a Mac OSX GNU bash, version 4.4.12(1)
-xswitch for line regex instead of-wfor word? However I think the-Fswitch will cancel either of them out, or vice-versa. – jesse_b Oct 15 '17 at 11:39ipattern the second rather than the first pattern in thestopwordsfile also alters the behaviour. – JdeBP Oct 15 '17 at 15:06grepnor with GNUgrep3.1. – Kusalananda Oct 15 '17 at 15:42