Removing Characters when outputting to a script
Hi, i have this script that creates another script which lists all duplicate files and give the user an option to uncomment the line to allow it to remove the files, the script is as follows:
#############################
OUTF=henderson.sh;
echo "#! /bin/sh" > $OUTF;
find "$@" -type f -print0 |
xargs -0 -n1 md5sum |
sort --key=1,32 | uniq -w 32 -d --all-repeated=separate |
sed -r 's/^[0-9a-f]*( )*//;s/([^a-zA-Z0-9./_-])/\\\1/g;s/(.+)/#rm \1/' >> $OUTF;
chmod a+x $OUTF; ls -l $OUTF
#############################
the output looks like this:
#! /bin/sh
#rm \ \ ./.kde/share/fonts/fonts.dir
#rm \ \ ./.kde/share/fonts/overide/fonts.dir
but i need it to remove the \ \ ./. so that the output looks like this:
#! /bin/sh
#rm kde/share/fonts/fonts.dir
#rm kde/share/fonts/overide/fonts.dir
Anyone any ideas?
Thanks
|