This script searches for files matching a given pattern under a specified directory, repairs double-encoded UTF-8 text, and transliterates German umlauts into ASCII equivalents.
Each processed file is backed up before modification.
./umlauts.sh '<pattern>' <path>- pattern: Filename pattern (e.g.
*.txt) - path: Directory to search
Examples:
./umlauts.sh '*.txt' /var/data
./umlauts.sh '*.csv' ./exports- Validates input arguments and path.
- Recursively finds matching files.
- Creates a
.savebackup of each file. - Repairs double-encoded UTF-8 using
iconv. - Transliterates German umlauts:
ä→ae,Ä→Aeö→oe,Ö→Oeü→ue,Ü→Ueß→ss
- Modified files (with umlauts transliterated).
- Backup files named
<filename>.save. - Console output listing each file processed and a final summary.
- Bash
- Tools:
findiconvsed
- Always verify the
.savebackups if the transliteration needs to be reversed. - Only processes files that match the given pattern.
- Exits with an error if no files match.
This script is covered under the repository’s main MIT License.