Skip to content

Instantly share code, notes, and snippets.

@mahasak
Forked from bikz05/remove_txt
Last active August 29, 2015 14:23
Show Gist options
  • Save mahasak/21e897cd7905da20d114 to your computer and use it in GitHub Desktop.
Save mahasak/21e897cd7905da20d114 to your computer and use it in GitHub Desktop.
echo $"Script Written by $(tput setaf 5)Bikram Hanzra$(tput sgr 0) (bikz.05@gmail.com)"$
if [ "$#" == 0 ] ; then
echo "$(tput setaf 1)We need at least 2 arguments"
echo "SYNTAX ./remove <file-name> <text-to-be-removed>"
echo "<text-to-be-removed> by default = www.it-ebooks.info$(tput sgr 0)"
exit
fi
if [ "$#" == 1 ] ; then
echo "$(tput setaf 1)CAVEAT$(tput sgr 0) -> Will remove occurances of -> $(tput setaf 1)"www.it-ebooks.info"$(tput sgr 0)"
set -- "${@:1}" "www.it-ebooks.info"
fi
# Display files names
echo "$(tput setaf 4)File Name ->" "$1"$'\n'"Text to be removed-> " "$2 $(tput sgr 0)"
# Include the watermark
sed -e "s/"$2"/ /g" <"$1" >unwatermarked.pdf && pdftk unwatermarked.pdf output fixed.pdf && mv fixed.pdf unwatermarked.pdf
mv unwatermarked.pdf "$1"
echo "$(tput setaf 4)Removing Watermark Successful :)$(tput sgr 0)"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment