nonascii matcher
This commit is contained in:
16
conv1to2
16
conv1to2
@@ -3,14 +3,26 @@
|
||||
IFS=$'\n'
|
||||
if [ -z "$1" ]
|
||||
then echo rename files in current folder replacing arg1 with arg2.
|
||||
echo '-n for match non ascii, replace with arg2'
|
||||
exit
|
||||
fi
|
||||
|
||||
for file in $( ls | grep "$1" )
|
||||
if [ "$1" = "-n" ]
|
||||
then for file in $( ls | grep -P "[\x80-\xFF]" )
|
||||
do echo "$file" '->' "$( echo $file | tr -d \\n\\r | tr -c [:print:] '\000' | sed s/'\x0'/"$2"/g )"
|
||||
done
|
||||
echo 'sure?'
|
||||
read i
|
||||
for file in $( ls | grep -P "[\x80-\xFF]" )
|
||||
do mv -iv -- "$file" "$( echo $file | tr -d \\n\\r | tr -c [:print:] '\000' | sed s/'\x0'/"$2"/g )"
|
||||
done
|
||||
exit
|
||||
fi
|
||||
for file in $( ls | grep -- "$1" )
|
||||
do echo "$file" '->' "$( echo $file | sed s/"$1"/"$2"/g )"
|
||||
done
|
||||
echo 'sure?'
|
||||
read i
|
||||
for file in $( ls | grep "$1" )
|
||||
for file in $( ls | grep -- "$1" )
|
||||
do mv -iv -- "$file" "$( echo $file | sed s/"$1"/"$2"/g )"
|
||||
done
|
||||
|
||||
Reference in New Issue
Block a user