Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Perl > Perl Misc > Writing at exact location in file

Reply
Thread Tools

Writing at exact location in file

 
 
rahulthathoo
Guest
Posts: n/a
 
      11-03-2006
Hi
I want to write to a file - which already exits and has some
data in it. I dont want to erase that data. Say suppose it has 30
lines of text in it. I want to write something in the first line after
the first two words. How do i go about it. I know how to open a file
but I am not able to seek to the right position and not able to write
my text without deleting the entire data of the file but i dont want
that. Can you help me here.

Thanks
Rahul

 
Reply With Quote
 
 
 
 
Mumia W. (reading news)
Guest
Posts: n/a
 
      11-03-2006
On 11/02/2006 11:49 PM, rahulthathoo wrote:
> Hi
> I want to write to a file - which already exits and has some
> data in it. I dont want to erase that data. Say suppose it has 30
> lines of text in it. I want to write something in the first line after
> the first two words. How do i go about it. I know how to open a file
> but I am not able to seek to the right position and not able to write
> my text without deleting the entire data of the file but i dont want
> that. Can you help me here.
>
> Thanks
> Rahul
>


The module Tie::File will let you treat a file as an array in Perl.

Start->Run->"perldoc Tie::File"


--
http://www.velocityreviews.com/forums/(E-Mail Removed)
 
Reply With Quote
 
 
 
 
rahulthathoo
Guest
Posts: n/a
 
      11-03-2006
Thanks
Mumia W. (reading news) wrote:
> On 11/02/2006 11:49 PM, rahulthathoo wrote:
> > Hi
> > I want to write to a file - which already exits and has some
> > data in it. I dont want to erase that data. Say suppose it has 30
> > lines of text in it. I want to write something in the first line after
> > the first two words. How do i go about it. I know how to open a file
> > but I am not able to seek to the right position and not able to write
> > my text without deleting the entire data of the file but i dont want
> > that. Can you help me here.
> >
> > Thanks
> > Rahul
> >

>
> The module Tie::File will let you treat a file as an array in Perl.
>
> Start->Run->"perldoc Tie::File"
>
>
> --
> (E-Mail Removed)


 
Reply With Quote
 
 
 
Reply

Thread Tools

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 On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Finding exact location of project files from intranet address Michelle Ang ASP .Net 1 09-04-2009 06:41 PM
Making 1 control invisible while showing another in the exact location of the invisible one Andy B ASP .Net 5 05-29-2008 03:08 AM
Location, location, location =?Utf-8?B?VHJhY2V5?= Wireless Networking 2 02-17-2007 08:37 PM
Determining the exact location and current state of any controls Peter Olcott Javascript 10 08-15-2006 07:06 PM
Exact Location of an Element Brett Foster Javascript 1 02-21-2005 08:34 PM



Advertisments