match counter
This commit is contained in:
8
conv1to2
8
conv1to2
@@ -6,12 +6,13 @@ then echo rename files in current folder replacing arg1 with arg2.
|
|||||||
echo '-n for match non ascii, replace with arg2'
|
echo '-n for match non ascii, replace with arg2'
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
|
c=0
|
||||||
if [ "$1" = "-n" ]
|
if [ "$1" = "-n" ]
|
||||||
then for file in $( ls | grep -P "[\x80-\xFF]" )
|
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 )"
|
do echo "$file" '->' "$( echo $file | tr -d \\n\\r | tr -c [:print:] '\000' | sed s/'\x0'/"$2"/g )"
|
||||||
|
c=$(( $c + 1 ))
|
||||||
done
|
done
|
||||||
echo 'sure?'
|
echo $c' matches. Sure?'
|
||||||
read i
|
read i
|
||||||
for file in $( ls | grep -P "[\x80-\xFF]" )
|
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 )"
|
do mv -iv -- "$file" "$( echo $file | tr -d \\n\\r | tr -c [:print:] '\000' | sed s/'\x0'/"$2"/g )"
|
||||||
@@ -20,8 +21,9 @@ then for file in $( ls | grep -P "[\x80-\xFF]" )
|
|||||||
fi
|
fi
|
||||||
for file in $( ls | grep -- "$1" )
|
for file in $( ls | grep -- "$1" )
|
||||||
do echo "$file" '->' "$( echo $file | sed s/"$1"/"$2"/g )"
|
do echo "$file" '->' "$( echo $file | sed s/"$1"/"$2"/g )"
|
||||||
|
c=$(( $c + 1 ))
|
||||||
done
|
done
|
||||||
echo 'sure?'
|
echo $c' matches. Sure?'
|
||||||
read i
|
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 )"
|
do mv -iv -- "$file" "$( echo $file | sed s/"$1"/"$2"/g )"
|
||||||
|
|||||||
Reference in New Issue
Block a user