grep non riesce quando si utilizzano entrambe le opzioni --ignore-caso e --only-match. Esempio:grep --ignore-case --only
$ echo "abc" | grep -io abc
abc
$ echo "ABC" | grep -io abc
$
Ma
$ echo "abc" | grep -i abc
abc
$ echo "ABC" | grep -i abc
ABC
Secondo la pagina man:
-o, --only-matching Show only the part of a matching line that matches PATTERN. -i, --ignore-case Ignore case distinctions in both the PATTERN and the input files.
Si tratta di un bug di grep o non ho avuto la pagina della mappa?
Sto usando Mac OS X 10.6.8 e
$ grep --version
grep (GNU grep) 2.5.1
trovato questo link: http://lists.gnu.org/archive/html/bug-gnu-utils/2003-11/msg00040.html
Naturalmente è possibile utilizzare come soluzione grep -o [aA][bB][cC]
, ma questo non sembra essere un buona opzione
Kenny, grazie! Quello che stai dicendo ha senso, cercherà di aggiornare. – schatten