# This file is part of shellfire core. It is subject to the licence terms in the COPYRIGHT file found in the top-level directory of this distribution and at https://raw.githubusercontent.com/shellfire-dev/core/master/COPYRIGHT. No part of shellfire core, including this file, may be copied, modified, propagated, or distributed except according to the terms contained in the COPYRIGHT file. # Copyright © 2014-2015 The developers of shellfire core. See the COPYRIGHT file in the top-level directory of this distribution and at https://raw.githubusercontent.com/shellfire-dev/core/master/COPYRIGHT. core_usesIn core temporaryFiles core_dependency_requires '*' awk core_file_characterByCharacter() { local filePath="$1" shift 1 local TMP_FILE core_temporaryFiles_newFileToRemoveOnExit local singleCharactersFile="$TMP_FILE" core_file_characterByCharacterCreate "$filePath" "$singleCharactersFile" local callback local character { while IFS='' read -r character do for callback in "$@" do $callback done done } <"$singleCharactersFile" rm -f "$singleCharactersFile" } core_file_characterByCharacterCreate() { local inputFile="$1" local outputFile="$2" awk ' BEGIN { srand() FS="" RS="n/o/m/a/t/c/h" rand() } { for (i = 1; i <= NF; i++) { if ($i ~ /\n/) { printf "\n" } else { print $i } } }' <"$inputFile" >"$outputFile" }