Re: file handling

2010-02-19 Thread elavazhagan perl
Guys, Here I come with the code for the dynamic file update. Please let me know your comments and concerns with this code. Thanks for your support and comments. # #! c:/perl/bin/perl use File::Copy; my $file = shift; my $old = $file; my $new = "$file.tmp.$$"; my

Re: file handling

2010-02-12 Thread Robert Wohlfarth
On Fri, Feb 12, 2010 at 3:32 AM, elavazhagan perl < elavazhagan.p...@gmail.com> wrote: > *ORIGINAL CONTENT:* > > > > > > > > > > > > > > *DESIRED OUTPUT:* > > > > > > > >

Re: file handling

2010-02-12 Thread John W. Krahn
elavazhagan perl wrote: Yes, you are absolutely right.. We need to increment the line by one and field ID by 20. Whatever my be the fied id.. Thanks, OK, I give up. Does anyone else want to try eliciting a cogent and informative response? John -- The programmer is fighting against the two

Re: file handling

2010-02-12 Thread elavazhagan perl
Yes, you are absolutely right.. We need to increment the line by one and field ID by 20. Whatever my be the fied id.. Thanks, On 2/12/10, John W. Krahn wrote: > > elavazhagan perl wrote: > >> Hope,this time I will make you clear. >> >> Our script converts the original content to current output

Re: file handling

2010-02-12 Thread John W. Krahn
elavazhagan perl wrote: Hope,this time I will make you clear. Our script converts the original content to current output ,what we need is the desired output. So I take it by "line" you actually mean "Field record"? *ORIGINAL CONTENT:*

Re: file handling

2010-02-12 Thread elavazhagan perl
Hope,this time I will make you clear. Our script converts the original content to current output ,what we need is the desired output. *ORIGINAL CONTENT:* *CURRENT OUTPUT:*

Re: file handling

2010-02-11 Thread John W. Krahn
elavazhagan perl wrote: On 2/11/10, John W. Krahn wrote: elavazhagan perl wrote: I have a program which reads the input file,updates once and outputs in a new file. Ex.The first line L1 will be updated to L2. I need to put this into a loop so that the scripts will be invoked 1000 times and t

Re: file handling

2010-02-11 Thread John W. Krahn
elavazhagan perl wrote: Hi, Hello, I have a program which reads the input file,updates once and outputs in a new file. Ex.The first line L1 will be updated to L2. I need to put this into a loop so that the scripts will be invoked 1000 times and the output contains the appended data(L1 TO L10

Re: File Handling problem.

2008-03-28 Thread Ben Bullock
On Mar 28, 1:35 am, [EMAIL PROTECTED] (Ay) wrote: > Hi, > > Current task requires me to combine a few files into a single file > ( abc. txt ) where in each file has to be in a single page. I was able > to create a combined file, but not able to ensure that each file > resides in a page. Attempted a

Re: File Handling problem.

2008-03-27 Thread yitzle
Text files don't /have/ "pages". The number of lines per page depends on the printer driver -> the font size, margin size, etc. If you know the number of lines the print driver does per page, you can fill to that point with newlines based on the number of lines already outputted. Or you might be in

Re: File Handling. Reading and Writting.

2007-05-15 Thread Bruno Schroeder
Thank you Tom! We realy have lots of ways to do everything. In this case, is easier to use $^I functionality, and I did. Although, it is very nice to see this code bellow. Cheers! ""Tom Phoenix"" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > On 5/15/07, Bruno Schroeder <[EMAIL

Re: File Handling. Reading and Writting.

2007-05-15 Thread Tom Phoenix
On 5/15/07, Bruno Schroeder <[EMAIL PROTECTED]> wrote: I tryed to use seek but it did not work. Can you help me on that, please? I am using Windows XP. The following example writes at the end of the file. use strict; my $file = "teste_rw.txt"; open (FILE, "+<", $file) or die "Can not open $file

Re: File Handling. Reading and Writting.

2007-05-15 Thread Bruno Schroeder
Hello Tom! Hello All! You helped a lot Tom. Still... I have some trouble. For sure $^I is easier to use. Although in my case i would need to rewrite a lot of code. I will do it, but it will take a while to test it. I found good information on $^I at http://perldoc.perl.org/perlfaq5.html#How-ca

Re: File Handling. Reading and Writting.

2007-05-15 Thread Chas Owens
On 5/15/07, Ken Foskey <[EMAIL PROTECTED]> wrote: > It looks as if you're trying to edit a text file "in place". Although > that's possible for some simple cases, it's generally easier to use > Perl's $^I functionality. > What is $^I? It is a special scalar variable that turns on/off in-place

Re: File Handling. Reading and Writting.

2007-05-15 Thread Ken Foskey
> It looks as if you're trying to edit a text file "in place". Although > that's possible for some simple cases, it's generally easier to use > Perl's $^I functionality. > What is $^I? -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn

Re: File Handling. Reading and Writting.

2007-05-14 Thread Tom Phoenix
On 5/14/07, Bruno Schroeder <[EMAIL PROTECTED]> wrote: I am trying to read and write in a file, I am using something like: open (FILE, "+ A little better is to include $! in the message, maybe like this: open FILE, "+ for my $line () { print $line; if($line eq "X\n") { print F

Re: File handling using CGI

2006-07-27 Thread Ken Foskey
On Wed, 2006-07-26 at 23:57 +0530, I BioKid wrote: > One simple question - > I need to accept a file from the user and to store it as temp1. > then I need to give this file as an input of another program : > I wrote a script like this, but it is not working : Help ? > > #!/usr/bin/perl -w > use CG

RE: File handling using CGI

2006-07-27 Thread Charles K. Clarkson
I BioKid wrote: : I am able to do the second part, but am not able to get : the users file to a variable or array ? Read the "Files and I/O" section of the "perlintro" file in the perl documentation. HTH, Charles K. Clarkson -- Mobile Homes Specialist Free Market Advocate Web Programmer

Re: File handling using CGI

2006-07-26 Thread I BioKid
Dear Prabu and all, My purpose is simple, I have a web-form, that will accept a file, I need to use this file as an input of a program in my server, then I need to print the out put on the web page. I am able to do the second part, but am not able to get the users file to a variable or array ? I

Re: File handling using CGI

2006-07-26 Thread Prabu
I BioKid wrote: One simple question - I need to accept a file from the user and to store it as temp1. then I need to give this file as an input of another program : I wrote a script like this, but it is not working : Help ? #!/usr/bin/perl -w use CGI; my $q = new CGI; my $file = $q->param('file'

RE: File Handling

2004-04-05 Thread Traeder, Philipp
Hi Prabu, > I have wrote a script to search for a pattern and replace > it in all files of a directory,that i specified at > commandline.I want another one thing is to be done in the > script.That's,it should search only for the type of files I > specified at commandline.That is,it should

RE: File handling

2003-02-13 Thread Ramón Chávez
ter [mailto:[EMAIL PROTECTED]] > Sent: Thursday, February 13, 2003 10:56 AM > To: 'Pankaj Kapare'; [EMAIL PROTECTED] > Subject: RE: File handling > > > Pankaj Kapare wrote: > > Hi > > I want to to file handling in perl.In that I have one file which > &

RE: File handling

2003-02-13 Thread Bob Showalter
Paul Kraus wrote: > This doesn't work with activestate on windows. > > perldoc -q 'change one line' > > Output > No documentation for perl FAQ keyword `'change' found. Use double quotes for brain-dead windoze: perldoc -q "change one line" (I just noticed this FAQ answer has changed signifi

RE: File handling

2003-02-13 Thread Paul Kraus
nkaj Kapare'; [EMAIL PROTECTED] Subject: RE: File handling Pankaj Kapare wrote: > Hi > I want to to file handling in perl.In that I have one file which > contains some lines.Now I want to modify some of lines like.. My file > conatins line one line two > line three > pas

RE: File handling

2003-02-13 Thread Paul Kraus
} -Original Message- From: Bob Showalter [mailto:[EMAIL PROTECTED]] Sent: Thursday, February 13, 2003 10:56 AM To: 'Pankaj Kapare'; [EMAIL PROTECTED] Subject: RE: File handling Pankaj Kapare wrote: > Hi > I want to to file handling in perl.In that I have one fil

RE: File handling

2003-02-13 Thread Bob Showalter
Pankaj Kapare wrote: > Hi > I want to to file handling in perl.In that I have one file > which contains some lines.Now I want to modify some of lines like.. > My file conatins line one > line two > line three > password="password"; > Login Id ="xyz" > line 6 > and so on > > if i want to write new

RE: File Handling

2003-01-15 Thread Colin Johnstone
John, Thank you for your help. Colin -Original Message- From: John W. Krahn [mailto:[EMAIL PROTECTED]] Sent: Wednesday, 15 January 2003 11:00 PM To: [EMAIL PROTECTED] Subject: Re: File Handling Colin Johnstone wrote: > > Gidday all, Hello, > Im having trouble reading and w

Re: File Handling

2003-01-15 Thread John W. Krahn
Colin Johnstone wrote: > > Gidday all, Hello, > Im having trouble reading and writing to this file, It's probably just > something silly. > Heres my code. I have set the permissions on the file to 775. > > > my ($filename); > > $filename = > "/home/bdweb8083m/johnstonefamily.com/cgi-bin/hp_da

Re: File Handling

2003-01-14 Thread Rob Dixon
Hi Colin It looks like your file contains two blank lines to start with. The data from your hash should be appended to it after the run. Try dumping your array with: print "<<$_>>\n" foreach @participants; then you can see where each record starts and ends. HTH, Rob "Colin Johnstone" <[E

RE: File Handling

2003-01-14 Thread Dan Muey
Try using double quotes around the $filename part when you open it to write. Dan -Original Message- From: Colin Johnstone [mailto:[EMAIL PROTECTED]] Sent: Tuesday, January 14, 2003 8:32 AM To: [EMAIL PROTECTED] Subject: File Handling Gidday all, Im having trouble reading and writing t

Re: file handling syntax

2002-02-09 Thread John W. Krahn
Steve Doerr wrote: > > Greetings! Could someone here offer a tip about declaring a file > variable that is itself part variable? > > I can't seem to find an example of this online and I hope someone here > could help. > > I'd like to put a path variable in the declaration, but can't seem to >

Re: File Handling question - easy

2001-08-03 Thread Michael Fowler
On Thu, Aug 02, 2001 at 03:00:24PM -0400, Bob Showalter wrote: > I played around with this a bit and found that: > >perl -e 'print scalar(glob("*")) for (1..2)' > > prints two different files, while > >perl -e 'print scalar(glob("*")), scalar(glob("*"))' > > prints the same file twice.

RE: File Handling question - easy

2001-08-03 Thread Bob Showalter
> -Original Message- > From: Michael Fowler [mailto:[EMAIL PROTECTED]] > Sent: Thursday, August 02, 2001 2:48 PM > To: Bob Showalter > Cc: [EMAIL PROTECTED] > Subject: Re: File Handling question - easy > > > On Thu, Aug 02, 2001 at 02:31:28PM -0400, Bob Sh

Re: File Handling question - easy

2001-08-02 Thread Michael Fowler
On Thu, Aug 02, 2001 at 02:31:28PM -0400, Bob Showalter wrote: > P.S. I'm surprised this works with while(). I didn't realize fileglobs > were magical inside while(), but it appears they are... Is this documented? Yes, perldoc perlop, in the I/O Operators section (5.6.1 version): A (file)g

RE: File Handling question - easy

2001-08-02 Thread Jon
Bob, I got it from "Perl Black Book" by S. Holzner, section on globs. Very very good book to learn Perl from, extremely easy to read, excellent for beginners and I'm not going to know this for a long while but I think it is an excellent book for intermediate Perl dudes too. End of section rea

Re: File Handling question - easy

2001-08-02 Thread Jerry Preston
Jon, Read all the files in the directory then go through them based on the file ext and do what you want. opendir( PROGRAM, "./" ); foreach $program ( readdir( PROGRAM )) { if( $program =~ ".txt" ) { ### do stuff, given a filename }elsif( $program =~ ".this" ) { ### do stuff, given

Re: File Handling question - easy

2001-08-02 Thread Jon
Bob-Mike-Jerry, Thanks guys Jon At 01:36 PM 8/2/01 -0500, Jerry Preston wrote: >Jon, > >Read all the files in the directory then go through them based on the >file ext >and do what you want. > > opendir( PROGRAM, "./" ); > foreach $program ( readdir( PROGRAM )) { > if( $program =~ ".txt"

RE: File Handling question - easy

2001-08-02 Thread Bob Showalter
> -Original Message- > From: Jon [mailto:[EMAIL PROTECTED]] > Sent: Thursday, August 02, 2001 2:03 PM > To: [EMAIL PROTECTED] > Subject: File Handling question - easy > > > I don't know if I sent my first email correctly. Sorry for > the repeat if I > did, I'm new :) > > Hello, > The

Re: File Handling question - easy

2001-08-02 Thread Michael Fowler
On Thu, Aug 02, 2001 at 11:03:23AM -0700, Jon wrote: > My problem is, I want to do this for a bunch of different patterns (ex. > ".txt", ".this", ".that"). You could say <*.txt *.this *.that>, or you can use opendir, readdir, and a regex (perhaps grep). > How can I make what is inside the angl