#!/usr/bin/env bash set -eux function remove_notice { # Remove old copyright notice - matches /* Copyright ... */ including the trailing newline # The 's' flag makes . match newlines, allowing multi-line matching # The \n? matches an optional newline after the closing */ perl -i -0pe 's/\/\* Copyright.*?\*\/\n?//s' "$1" } function add_notice { ed "$1" <