I would like to remove escaped characters from file names, so these examples
=Web_Help_Desk_Pro%26Lite.pdf =Windows_7_%2b_s-drev.pdf
will become
=Web_Help_Desk_ProLite.pdf =Windows_7__s-drev.pdf
Does anyone know how to do this in Perl or BASH?
To simply remove the percent sign and the following two hexadecimal digits:
$path =~ s/%[\da-f][\da-f]//gi;
If $file is your file name:
$file
my $file = '=Web_Help_Desk_Pro%26Lite.pdf'; $file =~ s/%[0-9a-f]{2}//gi;
i.e. replace % followed by two hexadecimal characters with an empty string.
%
This should work
sed 's/%[[:alnum:]]\{2\}//g' INPUT_FILE
Based on your help, I came up with
for f in $(find . -name \*.html); do mv $f $(echo $f | sed 's/%[a-z0-9][a-z0-9]//gi') done
If you don't mind addiction, there is a convmv 'command:
convmv --unescape --notest <files>
Try the following:
rename 's/\r//' *.html
Source: https://habr.com/ru/post/1390129/More articles:https://translate.googleusercontent.com/translate_c?depth=1&rurl=translate.google.com&sl=ru&sp=nmt4&tl=en&u=https://fooobar.com/questions/1390124/passing-parameters-from-teamcity-properties-to-the-command-line&usg=ALkJrhhCsOEJ_eFljFgC5rhG4XgvP49UMgHow can I run a ruby ββcode block from Terminal.app? - command-lineCovariance approximation for arrays of various sizes - pythonWhat to do if missing DLL files are included in the _PublishedWebsites folder - tfsTwigjs and dynamic translations - phpRails middleware update - ruby ββ| fooobar.comAsynchronous page updates on ASP.NET side - javascriptFormatting output with the same number of columns - javaHash Map Object Key - javaPrint a string in C with pointer arithmetic, including arrays, integers and pointers - cAll Articles