1

I am downloading a log file from a security system as txt file, The log contain one or more lines where there is only single space between every 2 words, however, when i downloaded it and opened in notepad, I can see random multiple spaces are added between words.

Can anyone explains why this happens and how can i fix it?

4
  • 1
    This will be an issue with the program writing to the log file. Commented Aug 20, 2021 at 8:42
  • 1
    If the spaces bother you, remove them using a text editor.
    – harrymc
    Commented Aug 20, 2021 at 9:47
  • 1
    Are you sure they are spaces? Have you looked at the file in a hex editor and ensured that they are 0x20 ? Commented Aug 20, 2021 at 16:46
  • Thanks all, It appears that the raw logs contain these spaces, so I misunderstood the problem
    – Basem
    Commented Sep 1, 2021 at 14:24

1 Answer 1

0

One way to fix this is to load the text file in a text editor that supports regex (regular expression) find and replace (such as Notepad++). Then find all:

[space]+

and replace with:

[space]

where you type a space instead of literally typing [space].

Note that some editors will require regex to be encapsulated in forward slashes. For these editors, find:

/[space]+/

and replace with

/[space]/

Again, substituting a real space for [space].

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .