R
R
Roman Bolshukhin2021-07-30 17:15:59
linux
Roman Bolshukhin, 2021-07-30 17:15:59

How to change cyrillic to latin using tr?

Good afternoon. Tell me, please, how to replace Cyrillic with Latin through TR? Thanks

#!/bin/bash
#ищем файлы с расширением .mkv, .m4v
Downloads_file=$(find /volume1/Geroev_Avenue_18/Downloads/ -maxdepth 1 -type f \( -iname "*.mkv" -or -iname "*.m4v" -or -iname "*.mp4" -or -iname "*.ts" \) -and -mmin +1 -exec basename "{}" ';'| shuf -n 1 | sed -n '1p' ); 
#echo $Downloads_file
if [ -n "$Downloads_file" ]; then
Downloads_file_film=$(find /volume1/Geroev_Avenue_18/Downloads/ -maxdepth 1 -type f \( -iname "*.mkv" -or -iname "*.m4v" -or -iname "*.mp4" -or -iname "*.ts" \) -and -mmin +1 | sed -n '1p' );
#echo $Downloads_file_film
fi
#ищем местоположение в загрузках
if [ -n "$Downloads_file_film" ]; then
Downloads_folder=$(find /volume1/Geroev_Avenue_18/Downloads/ -maxdepth 1 -type f \( -iname "*.mkv" -or -iname "*.m4v" -or -iname "*.mp4" -or -iname "*.ts" \) -and -mmin +1 -exec dirname "{}" ';' | sed -n '1p' ); 
#echo $Downloads_folder
fi
#Media Renaimer 
if [ -n "$Downloads_folder" ]; then
  # sed-ом заменяем символы кирилицы на символы латиницы
   TRS=` echo $Downloads_file | tr [:blank:] "_"`
  
  mv -v "$Downloads_folder""/""$Downloads_file" "$Downloads_folder""/""$TRS"
fi
#проверяем наличие найденного файла & отправляем сообщение в Телеграмм
if [ -n "$Downloads_file_film" ]; then mv -nfv "$Downloads_file_film" /volume1/Geroev_Avenue_18/Shared_Videos/Films/ && curl -X GET -k "https://api.telegram.org/bot180&text=Films for PLEX App has been updated, file is "$TRS""; 
fi

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question