cat script.txt| perl -nle 'if (/^===\w+\s*$/){ next # ??? how to ignore first $_, here eg. ===Hello, to directly become replaced by next line ; # ... } print'