By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,982 Members | 1,919 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,982 IT Pros & Developers. It's quick & easy.

Using PHP offline to manipulate text files

P: n/a
I need to create an application that will do fairly simple text manipulation
on 20,000 files in text format (html files). The files exist both on my
Windows machine and on a FreeBSD server. I prefer to do the manipulation on
my machine where it's easier to create backup copies, recover from
programming errors and so on, then upload the files to the server. All I'm
doing is extracting certain elements from each file and creating a different
file with the same content that will look better. I could do this in
FrontPage (or even Notepad) if I didn't have 20,000 files, so I need to
write an application that go through each file in a directory, open it,
locate the relevant text elements and create a new file that has these text
elements in an appropriate format.

I'm comfortable that I can write an application like this in PHP, even
though I do not have PHP installed on my computer, which is a Windows box
and is not being used as a server. Does this make sense? Can I install and
use PHP for this purpose without lots of server-related baggage? Any
pointers on using PHP this way?

TIA
Jul 17 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
Without the server-related baggage means you'll be limited to the CLI
version of PHP (which will run from any batch file for any DOS in
Windows including XP). I wrote a simple script myself that works under
the CLI version to clean multiple mailboxes in a mail directory.
You're more than welcome to it, if CLI is the route you take.

Richard

On Sun, 14 Dec 2003 13:25:19 -0600, "Anonymous" <an**@fairmark.com>
wrote:
I need to create an application that will do fairly simple text manipulation
on 20,000 files in text format (html files). The files exist both on my
Windows machine and on a FreeBSD server. I prefer to do the manipulation on
my machine where it's easier to create backup copies, recover from
programming errors and so on, then upload the files to the server. All I'm
doing is extracting certain elements from each file and creating a different
file with the same content that will look better. I could do this in
FrontPage (or even Notepad) if I didn't have 20,000 files, so I need to
write an application that go through each file in a directory, open it,
locate the relevant text elements and create a new file that has these text
elements in an appropriate format.

I'm comfortable that I can write an application like this in PHP, even
though I do not have PHP installed on my computer, which is a Windows box
and is not being used as a server. Does this make sense? Can I install and
use PHP for this purpose without lots of server-related baggage? Any
pointers on using PHP this way?

TIA


Jul 17 '05 #2

P: n/a
Ron
On Sun, 14 Dec 2003 13:25:19 -0600, "Anonymous" <an**@fairmark.com>
wrote:
I need to create an application that will do fairly simple text manipulation
on 20,000 files in text format (html files). The files exist both on my
Windows machine and on a FreeBSD server. I prefer to do the manipulation on
my machine where it's easier to create backup copies, recover from
programming errors and so on, then upload the files to the server. All I'm
doing is extracting certain elements from each file and creating a different
file with the same content that will look better. I could do this in
FrontPage (or even Notepad) if I didn't have 20,000 files, so I need to
write an application that go through each file in a directory, open it,
locate the relevant text elements and create a new file that has these text
elements in an appropriate format.

I'm comfortable that I can write an application like this in PHP, even
though I do not have PHP installed on my computer, which is a Windows box
and is not being used as a server. Does this make sense? Can I install and
use PHP for this purpose without lots of server-related baggage? Any
pointers on using PHP this way?

TIA

If you are doing a search and replace why not use Dreamweaver? It's
definitely in the full version and maybe in a trial version but it
lets you do a find and replace in all files in the same folder. I've
done it with 500 files but I'm not sure with 20000. Good luck.

thx..ron
Jul 17 '05 #3

P: n/a
> If you are doing a search and replace why not use Dreamweaver? It's
definitely in the full version and maybe in a trial version but it
lets you do a find and replace in all files in the same folder. I've
done it with 500 files but I'm not sure with 20000. Good luck.


I think I need something more powerful than multi-file search and replace
because I'm actually extracting several key elements from each of the
existing pages and creating a new page in an entirely different format
containing those elements. I could play with this concept, but it seems more
straightforward to write a little application that opens each file, extracts
the necessary information into a half-dozen variables, then writes a new
file to replace the old one.
Jul 17 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.