I have a command to replace the non printable characters and single quotes from a file but its taking more time to execute as I am replacing these characters for multiple files and the files size is around 30GB.
LANG=iso-8859-1 sed -i 's/[^[:print:]]//g;s/'\''//g;s/'//g' $path/EID*_$1.xml
The $path
and $1
passing through parameters. How can I make the process run faster and is there any other command which I can use? I heard tr
command is faster compare to sed
but how can I use the tr
command in my situation. (tr
command in single line for all the files).
I tried this command:
LANG=iso-8859-1 sed 's/[^[:print:]]//g;s/'\''//g;s/'//g' < $path/EID123_$1.xml > $path/EID123_$1_new.xml
mv -f $path/EID123_$1_new.xml EID123_$1.xml
LANG=iso-8859-1 sed 's/[^[:print:]]//g;s/'\''//g;s/'//g' < $path/EID456_$1.xml > $path/EID456_$1_new.xml;
mv -f $path/EID456_$1_new.xml EID456_$1.xml
for each single files without i option but its not giving the expected result and I could still see the non printable characters in file.
'
supposed to be, for example? – terdon Feb 11 '16 at 14:57strings
command work for you? – Rui F Ribeiro Feb 11 '16 at 15:43