I have a text document that has a load of text which has an extra space added after every letter!Example:T h e  b o o k  a l s o  h a s  a n  a n a l y t i c a l  p u r p o s e  w h i c h  i s  m o r e  i m p o r t a n tVisually:T&blank;h&blank;e&blank;&blank;b&blank;o&blank;o&blank;k&blank;&blank;alsohasananalyticalpurposewhichismoreimportantNote that there is an extra space after every letter,so there are two spaces between consecutive words.Is there a way that I can get awk or sed to delete the extra spaces?(Unfortunately this text document is massive andwould take a very long time to go through manually.)I appreciate that this is probably a much more complex problem to solve with just a simple bash script as there needs to be some sort of text recognition also. How can I approach this problem?
A script that deletes extra spaces between letters in text
text processing;sed;awk;scripting
The following regex will remove the first space in any string of spaces.That should do the job.s/ ( *)/\1/gSo something like:perl -i -pe 's/ ( *)/\1/g' infile.txt...will replace infile.txt with a fixed version.