kb0000 Posted June 3, 2010 Share Posted June 3, 2010 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? Quote Link to comment Share on other sites More sharing options...
ignace Posted June 3, 2010 Share Posted June 3, 2010 $lines = file('path/to/file.txt', FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES); Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.