Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
find and replace with
Old 12-29-2009, 11:39 AM find and replace with
Average Talker

Posts: 24
Trades: 0
Hi Webmaster-talkers... I looking for some help here.... may someone can help me, I have thousand MB data already in text file (.txt) and i want to edit them instantly through php code, like find any text with AA and replace them to BB in all .txt format, that possible? and where i can found the script? at the past i edited one by one with manual used Macromedia Dreamweaver but that need very long time and very tired... i hopefully one of you can give me some input. Regards
jones is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 12-29-2009, 12:56 PM Re: find and replace with
chrishirst's Avatar
Missing! presumed drunk.

Posts: 42,385
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
And are these files located on a PHP enabled server?
__________________
Chris. ->>
Please login or register to view this content. Registration is FREE
<<-

A foolish consistency is the hobgoblin of little minds
Thought for today:- Is SEO the only industry where all the cowboys are Indians?
chrishirst is offline
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 12-29-2009, 10:30 PM Re: find and replace with
Average Talker

Posts: 24
Trades: 0
Quote:
Originally Posted by chrishirst View Post
And are these files located on a PHP enabled server?
Yes. i think we can move it to php enabled server...
Regards
jones is offline
Reply With Quote
View Public Profile
 
Old 12-30-2009, 02:53 AM Re: find and replace with
chrishirst's Avatar
Missing! presumed drunk.

Posts: 42,385
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
So if they are on your local machine just use something like EditPlus or NotePad++ to run through the files in situ and do the replace.
__________________
Chris. ->>
Please login or register to view this content. Registration is FREE
<<-

A foolish consistency is the hobgoblin of little minds
Thought for today:- Is SEO the only industry where all the cowboys are Indians?
chrishirst is offline
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 12-30-2009, 08:17 AM Re: find and replace with
Average Talker

Posts: 24
Trades: 0
Quote:
Originally Posted by chrishirst View Post
So if they are on your local machine just use something like EditPlus or NotePad++ to run through the files in situ and do the replace.
for now i use Macromedia Dreamweaver but i think that wasted my time, i must open file one by one, if your file more than 6 MB there are need some extra time to open, not simply.

i think use EditPlus or NotePad++ will be same with Macromedia Dreamweaver in the proccessing data

and I believe that php code can do it with simply way and bit quickly.. that i looking for
jones is offline
Reply With Quote
View Public Profile
 
Old 12-30-2009, 08:23 AM Re: find and replace with
chrishirst's Avatar
Missing! presumed drunk.

Posts: 42,385
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
Notepad++ will do a "Find in files" and it simply runs as a background task parsing all the files in the folder and subfolders until it runs out of work.

You will have problems with a php script timing out after 20 minutes.
__________________
Chris. ->>
Please login or register to view this content. Registration is FREE
<<-

A foolish consistency is the hobgoblin of little minds
Thought for today:- Is SEO the only industry where all the cowboys are Indians?
chrishirst is offline
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 12-30-2009, 09:47 AM Re: find and replace with
mgraphic's Avatar
Truth Seeker

Latest Blog Post:
JAMISONTUNES
Posts: 2,918
Name: Keith Marshall
Location: Connecticut
Trades: 0
PSPad also will allow regex search and replace features within files in a specified directory (only works with local files, not files through ftp).
__________________

<mgraphic /> - I don't have a solution but I admire the problem.
mgraphic is offline
Reply With Quote
View Public Profile
 
Old 12-31-2009, 12:14 AM Re: find and replace with
Average Talker

Posts: 24
Trades: 0
Let talk about problem solve from phpcode here.. i think we have the possible way how to revealed it with php code... i have another opinion:

PHP Code:
foreach((array)@glob('/path/to/files/*.txt') as $f
  if(
is_file($f)) 
    
file_put_contents($fstr_replace("CC""ZZ"file_get_contents($f))); 
above is the one php code that can find any text and replace them to what we want..

now how to expand it? like adding how to count replaced text or what filename can't open and echoing them
jones is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to find and replace with
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.96889 seconds with 12 queries