Skip to main content
6 events
when toggle format what by license comment
Oct 14, 2023 at 6:28 comment added G-Man Says 'Reinstate Monica' A perhaps less trivial example: seq 10 | grep -c '7*' prints 10, but seq 10 | grep -o '7*' | wc -l prints 1.
Oct 9, 2023 at 19:49 vote accept Arunabh
Oct 6, 2023 at 21:23 comment added Stéphane Chazelas There's also the usual question of whether overlapping matches should be counted (like if there are one or two occurrences of 99 in 999 or of aba in ababa).
Oct 6, 2023 at 21:17 comment added Stéphane Chazelas Beware grep -o only prints the non-empty matches. For instance seq 10 | grep -c '^' prints 10 but seq 10 | grep -o '^' | wc -l prints 0.
Oct 6, 2023 at 18:20 history edited Kusalananda CC BY-SA 4.0
added 141 characters in body
Oct 6, 2023 at 18:13 history answered Kusalananda CC BY-SA 4.0