Wed 26 Aug 2009 02:14:15 PM UTC, original submission:
> grep -V
GNU grep 2.5.3
(i didn't success in compiling the cvs version)
I was wondering which one-letter options exists in grep
$> man grep | grep -E "^\s+-[a-zA-Z][, ]"
-L, --files-without-match
-l, --files-with-matches
it unescapes the s and look for (at least) "s-"
$> man grep | grep -icE "^\s+-[a-zA-Z][, ]"
37
with -i switch, no problem
$> man grep | grep -E "s-"
-L, --files-without-match
-l, --files-with-matches
with bigger files, you know that the resulting regex is not only "s-"
then i've concatened a lot of manpages to test
$> grep -r . /usr/share/man/man* | cut -d" " -f3 > lsman
$> for i in `cat lsman`; do man $i >> allman; done
(this takes a lot of time, i stopped it when allman was 819101 lines, 39 Mib)
$> grep -cE "^\s+-[a-zA-Z][, ]" allman
93
$> grep -icE "^\s+-[a-zA-Z][, ]" allman
9778
$> grep -cE "^ +-[a-zA-Z]+s-[a-zA-Z]" allman
369
(trying to find the regex who will bring to 93)
$> grep -cE "^ +-[a-zA-Z][, ]" allman
9778
a space instead of \s is ok
$> grep -iE "^\s+-[a-zA-Z][, ]" allman | sort -u > allopts
i do that so i can send the file
$> wc -l allopts
4877 allopts
$> grep -cE "^\s+-[a-zA-Z][, ]" allopts
41
so i should grep all lines of allopts, but it takes only 41 (all containing "s-[a-zA-Z]")
i'm not sure \s is ok to mean space, but why it is working with -i
|