fork download
  1. #!/bin/bash
  2. s="#Foo bar
  3. Foo bar
  4. #Baz foo
  5. Baz foo"
  6. perl -pe 's/^#.*(*SKIP)(*F)|o{2,}/"O" x length($&)/ge' <<< "$s"
Success #stdin #stdout 0.01s 5532KB
stdin
Standard input is empty
stdout
#Foo bar
FOO bar
#Baz foo
Baz fOO