#!/bin/bash
# Recursively change all info files:
# del line beginning with @ in file "info" recursively, copy to "info.txt"
# lets file "info" untouched
# see: https://askubuntu.com/questions/444551/get-absolute-path-of-files-using-find-command
#      https://stackoverflow.com/questions/4321456/find-exec-a-shell-function
#      https://forum.ubuntuusers.de/topic/sonderzeichen-mit-sed-loeschen-oder-aendern-ak/
#
# 200607

function dosomething () {
   dir=$(dirname "$1")
   if ! test -f "${dir}"/info.txt; then
      sed '/^@/d' "$1" > "${dir}"/info.txt
   fi
}

export -f dosomething

if test -f "aaa"; then
  rm aaa
fi

find "$(pwd -P)" -name "info" -exec bash -c 'dosomething "{}"' \;   # ok

