cancel
Showing results for 
Search instead for 
Did you mean: 

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

SOLVED
Highlighted
Occasional Contributor

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

Tags (1)
1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Community Hero

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

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

 

Regards,
  /Alex [Community Hero]
____
[Community Heroes] are not employed by SmartBear Software but
are just volunteers who have some experience with the tools by SmartBear Software
and a desire to help others. Posts made by [Community Heroes]
may differ from the official policies of SmartBear Software and should be treated
as the own private opinion of their authors and under no circumstances as an
official answer from SmartBear Software.
The [Community Hero] signature is used with permission by SmartBear Software.
https://community.smartbear.com/t5/custom/page/page-id/hall-of-fame
================================

View solution in original post

3 REPLIES 3
Highlighted
Community Hero

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

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?

 

Regards,
  /Alex [Community Hero]
____
[Community Heroes] are not employed by SmartBear Software but
are just volunteers who have some experience with the tools by SmartBear Software
and a desire to help others. Posts made by [Community Heroes]
may differ from the official policies of SmartBear Software and should be treated
as the own private opinion of their authors and under no circumstances as an
official answer from SmartBear Software.
The [Community Hero] signature is used with permission by SmartBear Software.
https://community.smartbear.com/t5/custom/page/page-id/hall-of-fame
================================
Occasional Contributor

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

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 

Highlighted
Community Hero

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

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

 

Regards,
  /Alex [Community Hero]
____
[Community Heroes] are not employed by SmartBear Software but
are just volunteers who have some experience with the tools by SmartBear Software
and a desire to help others. Posts made by [Community Heroes]
may differ from the official policies of SmartBear Software and should be treated
as the own private opinion of their authors and under no circumstances as an
official answer from SmartBear Software.
The [Community Hero] signature is used with permission by SmartBear Software.
https://community.smartbear.com/t5/custom/page/page-id/hall-of-fame
================================

View solution in original post

New Here?
Join us and watch the welcome video:
Announcements
Top Kudoed Authors