Jump to content

Check a blank line while reading a file


kb0000

Recommended Posts

I want to read a file abc.txt

 

It has contents in the format

 

This is line 1.

 

This is line 3. Further in this line.

This is line 4.

 

This is line 6.

 

I want to read this file (line by line, i think) and check if the current line is blank (like there is no Line 2 i.e. a blank line.)

 

What I want to do is that - now in the above text file there are 3 sets of line or 3 paragraphs. I want to check if there is a blank line between two set of lines.

Or is there some way to fetch paragraphs???

 

I want to separate these 3 sets of line in 3 rows in an excel sheet.

i.e.

In excel sheet columns:

A1 - This is line 1.

A2 -This is line 3. Further in this line.

This is line 4.

A3 -

This is line 6.

 

How I can do this?

Link to comment
https://forums.phpfreaks.com/topic/203752-check-a-blank-line-while-reading-a-file/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.