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 |
Strange...I'm not getting theses double back slashes...
Code:
miguel@gold:~/tmp> cat henderson.sh |
Even odder!! when i run this script on SuSE 9.1 it dosent work at all, im running it on Knoppix 4.0 and it works like i mentioned before, im using the sh shell, im pretty new to Linux/Unix/GNU+Linux..... do the shells in different versions compile differently, i though sh would be the same on Knoppix and SuSE
|
maybe you have this problem (LC_ALL='C') :? ~> http://www.linuxquestions.org/questi...hreadid=327916
Quote:
|
All times are GMT -5. The time now is 07:53 AM. |