#!/usr/bin/env bash

# Copyright (C) Lightbend Inc. <https://www.lightbend.com>


cd manual
for f in `find . -name '*.md'`
do
  echo "<!--- Copyright (C) Lightbend Inc. <https://www.lightbend.com> -->" > /tmp/mdcw
  if head -n 1 $f | grep -qiE "(Lightbend|Typesafe) Inc. <https?://(www.)?(lightbend|typesafe).com"
  then
    tail -n +2 $f >> /tmp/mdcw
  else
    cat $f >> /tmp/mdcw
  fi
  cp /tmp/mdcw $f
  rm /tmp/mdcw
  echo Updated $f
done
