Forum Discussion

Geethanjali's avatar
Geethanjali
Occasional Contributor
4 years ago
Solved

Any idea why whole content of a text file is being considered as one line only?

hi,

 

There is something weird which am not able to figure out. I write some content in a text file and search for a content in the file reading line by line.  All the while it was working correctly. Suddenly the whole content of the file is considered as a single line and line count is provided as 1. 

 

Has anyone experienced this problem ? Appreciate any help here

 

Thanks

S.Geethanjali

  • AlexKaras's avatar
    AlexKaras
    4 years ago

    Hi,

     

    Should I use replace method to do that ?

    Yes, correct.

    Your editor should support search and replace of hexadecimal characters. (I believe that Notepad++, for example, supports this).

    Then, if, for example, all lines in the file are ended with just 0x0A, do search for 0x0A and replace with 0x0A0x0D

     

3 Replies

  • AlexKaras's avatar
    AlexKaras
    Champion Level 3

    Hi,

     

    It is my guess that the file was saved with lines separated not by CR LF symbols (0x0A, 0x0D IIRC), but only CR or LF.

    Try to open file in the hex editor and check and check what set of symbols is used to separate lines. If the set is not CR LF, do search and replace.

    Does this help?

     

    • Geethanjali's avatar
      Geethanjali
      Occasional Contributor

      I think suddenly the line separators have changed in the file. Not sure why.

      AlexKaras  - Should I use replace method to do that ? Can you kindly advise how to replace that in the whole file ? 

       

      Thanks

      S.Geethanjali 

      • AlexKaras's avatar
        AlexKaras
        Champion Level 3

        Hi,

         

        Should I use replace method to do that ?

        Yes, correct.

        Your editor should support search and replace of hexadecimal characters. (I believe that Notepad++, for example, supports this).

        Then, if, for example, all lines in the file are ended with just 0x0A, do search for 0x0A and replace with 0x0A0x0D