![]() |
| HTML | PHP Scripts | Webmaster Tools | Webmaster Forums | Web Hosting | Domain Names | Webmaster Books |
|
|
#1 |
|
New Member
Join Date: Nov 2009
Webmaster Discussions: 3
Rep Power: 6 ![]() |
extracting comments
Hi all, I know this probably an elementary question to some of you, but I'm just learning php myself.
I was wondering if someone could help me with a script to extract a comment line from a text file. I have alot of txt files handed to me at work and all of them have comments that I need to extract and combine into one txt file. Lets say that one txt file has bunch of sentence in it but usually at the end, it'd have a "Comment: brad does a great job of helping me" Is there a way where I could just drop all of the text files into a folder and let php extract all the comments and combined into one file? Thank you and any help would be very appreciated
Last edited by hottac; 11-06-2009 at 07:53 PM. |
|
|
|
|
|
#2 |
|
Join Date: Aug 2008
Location: Texas
Webmaster Discussions: 501
Rep Power: 21 ![]() ![]() ![]() ![]() |
Re: extracting comments from text file
Are the text files always formatted the same way? For example, are the comments always last and do they always begin with "Comment:"?
__________________
Be sure to click the reputation icon to give rep to the person who helped you. For web design/development services, check Silentium Designs. |
|
|
|
|
|
#3 |
|
New Member
Join Date: Nov 2009
Webmaster Discussions: 3
Rep Power: 6 ![]() |
Re: extracting comments from text file
yes, the text files are always formatted the same. For example:
something line something line Comment:brad does a great job of helping me and it can go on and wrap itself something line Thanks |
|
|
|
|
|
#4 |
|
Join Date: Aug 2008
Location: Texas
Webmaster Discussions: 501
Rep Power: 21 ![]() ![]() ![]() ![]() |
Re: extracting comments from text file
Use the following code, and modify it to do what you need. I have already modified it some for you.
PHP Code:
__________________
Be sure to click the reputation icon to give rep to the person who helped you. For web design/development services, check Silentium Designs. |
|
|
|
|
|
#5 |
|
New Member
Join Date: Nov 2009
Webmaster Discussions: 3
Rep Power: 6 ![]() |
Re: extracting comments from text file
oh nice jthayne, I will give it a try during my time off this holiday. Lets say if I need it to modify where the script looks inside a folder and open all the text files in the folder and extract any comments, will that be hard to integrate into this script you made? Thank you so much for your time and if I don't hear from you, have a nice thanksgiving.
|
|
|
|
![]() |
| Bookmarks |
| Tags |
| comments, extracting, file, text |
| Thread Tools | |
| Rate This Thread | |
|
|
Similar Webmaster Discussions
|
||||
| Thread | Webmaster Discussion Starter | Forum | Replies | Last Post |
| Extracting Form Field Values | ChubChub | HTML Forum | 0 | 10-10-2007 03:17 PM |
| Writing to text file problem | long123 | CGI Perl Forum | 5 | 08-02-2005 08:33 AM |
| displaying text in on a page from file... | robbyvegas | HTML Forum | 1 | 12-18-2003 01:23 PM |
| reading from text file to textarea using vbscript | vennly | Website Scripts Forum | 0 | 12-05-2003 03:03 AM |
| Email Text File | ScottB | CGI Perl Forum | 1 | 12-04-2001 02:08 PM |