Hacker News new | past | comments | ask | show | jobs | submit login

sorry, it is not same as `grep -iv '^c'`

the `-o` option allows to output only matching portion, the regex is meant to extract all words other than those starting with 'c' or 'C'

here's hopefully better example

    $ # do something with words not surround by quotes
    $ echo 'I like "mango" and "guava"' | perl -pe 's/"[^"]+"(*SKIP)(*F)|\w+/\U$&/g'
    I LIKE "mango" AND "guava"



Oh, you are right. I missed that all words are in the same line. That said even the original article mentions that it only moves the captured group to the entire match; I am generally in a position to avoid all uses of control verbs, especially if it only costs one or probably two lines of the additional code that I can fully control and comprehend.




Consider applying for YC's Spring batch! Applications are open till Feb 11.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: