replace or remove text on file PDF with sed
Good evening, i'm testing with the bash script for to replace text with new text on file PDF, i've resolved with the file exported from file txt to file PDF. But i've downloaded the file PDF on internet for test. i've searched with pdfgrep, for example "Roberto Rossi" and i've already tested with other name "Giuseppe Verdi", don't work. Where i've wronged? I attach the script. Thank and greetings
#!/bin/bash
function press_enter
{
echo ""
echo -n "Premere per continuare"
read
clear
}
selection=
until [ "$selection" = "0" ]; do
echo ""
echo "PROGRAMMA MENU"
echo "1 - Sostituire il testo nel file PDF"
echo "2 - Eliminare il testo nel file PDF"
echo ""
echo "0 - Uscire dal programma"
echo ""
echo -n "Scegliere il numero: "
read selection
echo ""
case $selection in
1 )
echo -n "Inserire il testo da cercare: "
read vecchiotxt
echo -n "Inserire il testo nuovo da sostituire: "
read nuovotxt
pdftk 2010-b4-003.pdf output esportato.pdf uncompress
sed -e "s/$vecchiotxt/$nuovotxt/g" modificato2.pdf
pdftk modificato2.pdf output provaMD2.pdf compress
echo "Sostituito il testo da $vecchiotxt a $nuovotxt" ;
enter ;;
2 )
echo -n "Inserire il testo da cercare: "
read cercatxt
pdftk prova.pdf output esportato.pdf uncompress
sed -e "s/$cercatxt//g" modificato.pdf
pdftk modificato.pdf output provaMD.pdf compress
echo "Eliminati i testi "$cercatxt" nel file PDF" ;
enter ;;
0 ) exit ;;
* ) echo "Please enter 1, 2, or 0"; press_enter
esac
done