CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Regular Expressions:
how to replace the required text in a flat file

 



rajjj
Novice

Aug 7, 2006, 4:59 AM

Post #1 of 3 (2257 views)
how to replace the required text in a flat file Can't Post

hi all

im trying to substitute some text in file with another text. while printing, im getting the text printed in the output but not in the oringinal file .

can anybody help me how to replace text in a file permanantly.

thanx in advance.


KevinR
Veteran


Aug 7, 2006, 2:06 PM

Post #2 of 3 (2255 views)
Re: [rajjj] how to replace the required text in a flat file [In reply to] Can't Post

use perls in place editor:

http://www.perl.com/pub/a/2004/10/14/file_editing.html

or use Tie::File

http://perldoc.perl.org/Tie/File.html

or open the file for reading, write the changes to a new file, delete the old file and rename the new file with the name of the old file.
-------------------------------------------------


(This post was edited by KevinR on Aug 7, 2006, 2:06 PM)


davorg
Thaumaturge / Moderator

Aug 8, 2006, 5:39 AM

Post #3 of 3 (2248 views)
Re: [rajjj] how to replace the required text in a flat file [In reply to] Can't Post

It's far easier to help if we can see your code.

--
Dave Cross, Perl Hacker, Trainer and Writer
http://www.dave.org.uk/
Get more help at Perl Monks

 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives