Re: Read a huge text file in perl

2018-05-24 Thread Shlomi Fish
Hi, On Thu, 24 May 2018 20:27:23 +0530 SATYABRATA KARAN wrote: > Hello, > Does anyone guide me how to handle a huge file (>50GB) in perl? > > I tried open method this way, but it's hanging the terminal. I think that > is out of memory error internally. > > open my $FILE, "<", "Log_file.txt"; >

Re: Read a huge text file in perl

2018-05-24 Thread David Precious
On Thu, 24 May 2018 20:27:23 +0530 SATYABRATA KARAN wrote: > Hello, > Does anyone guide me how to handle a huge file (>50GB) in perl? Your code should be looping line by line, and shouldn't use much memory, depending of course on how long the lines are, and what you're doing with them. It will

Re: Read a huge text file in perl

2018-05-24 Thread Chas. Owens
A lot depends on the contents of "some task;". If the task does not leave stuff in memory for each iteration, then it is just taking a long time. If it does leave stuff in memory, then you could easily run out of memory. Also, a lot depends on the OS. For instance, the defaults for filesystems

Read a huge text file in perl

2018-05-24 Thread SATYABRATA KARAN
Hello, Does anyone guide me how to handle a huge file (>50GB) in perl? I tried open method this way, but it's hanging the terminal. I think that is out of memory error internally. open my $FILE, "<", "Log_file.txt"; while (<$FILE>) { chomp; some task; ... } close $FILE; Thanks, Satya

Re: Replacing the first line of a text file

2014-02-05 Thread Nathan Hilterbrand
See below the quoted text On 02/03/2014 08:12 PM, SSC_perl wrote: I'm having a problem with the script below. I want to alter just the first line of a CSV file, removing the prefix "tag_" from each value in that line. However, because the new line is shorter than the original, the sc

Re: Replacing the first line of a text file

2014-02-04 Thread SSC_perl
Thanks everyone. Both Tie::File and File::Slurp work nicely for this purpose. Now comes the hard part - picking which one I want to use. ;) Frank http://www.surfshopcart.com/ Setting up shop has never been easier! -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additio

Re: Replacing the first line of a text file

2014-02-04 Thread Shawn H Corey
On Tue, 04 Feb 2014 11:59:30 + Rob Dixon wrote: > If it is satisfactory to leave the original file with trailing spaces > at the end of the first line, then you can do so like this > > use strict; > use warnings; > > my $filename = 'products.csv'; > open (my $fh, '+<', $filename) || die "ca

Re: Replacing the first line of a text file

2014-02-04 Thread Rob Dixon
On 04/02/2014 01:12, SSC_perl wrote: use strict; use warnings; my $filename = 'products.csv'; open (my $fh, '+<', $filename) || die "can't open $filename: $!"; my $line = <$fh>; $line =~ s/tag_//gi; seek $fh, 0, 0; printf {$fh} $line; close $fh; If it is satisfactory to leave the original fil

Re: Replacing the first line of a text file

2014-02-03 Thread Uri Guttman
On 02/03/2014 09:05 PM, Shawn H Corey wrote: On Mon, 03 Feb 2014 20:50:17 -0500 Uri Guttman wrote: Is there a way to replace the entire line with the new, shorter one? that is a unix problem and can't be done in any language. It's not even a UNIX problem. Windows and BSD have it too. It is

Re: Replacing the first line of a text file

2014-02-03 Thread Shawn H Corey
On Mon, 03 Feb 2014 20:50:17 -0500 Uri Guttman wrote: > > Is there a way to replace the entire line with the new, shorter > > one? > > that is a unix problem and can't be done in any language. It's not even a UNIX problem. Windows and BSD have it too. It is an artifact of how files are create

Re: Replacing the first line of a text file

2014-02-03 Thread Uri Guttman
On 02/03/2014 08:12 PM, SSC_perl wrote: I'm having a problem with the script below. I want to alter just the first line of a CSV file, removing the prefix "tag_" from each value in that line. However, because the new line is shorter than the original, the script is only over-writing part of the

Replacing the first line of a text file

2014-02-03 Thread SSC_perl
I'm having a problem with the script below. I want to alter just the first line of a CSV file, removing the prefix "tag_" from each value in that line. However, because the new line is shorter than the original, the script is only over-writing part of the original line (exactly the num

Re: delete blank lines from text file

2012-10-01 Thread Chris Stinemetz
On Mon, Oct 1, 2012 at 3:34 AM, Irfan Sayed wrote: > hi, > > i need to delete all blank lines from the text file > > I usually just skip the blank lines when I read the data one line at a time. Then you can print to a new file. My example is below: #!/usr/bin/perl use 5.010;

Re: delete blank lines from text file

2012-10-01 Thread Irfan Sayed
thanks a lot ! will improve the coding standard. regards, irfan From: Shlomi Fish To: Irfan Sayed Cc: Perl Beginners Sent: Monday, October 1, 2012 4:08 PM Subject: Re: delete blank lines from text file Hi Irfan, On Mon, 1 Oct 2012 01:34:51 -0700 (PDT

Re: delete blank lines from text file

2012-10-01 Thread Shlomi Fish
Hi Irfan, On Mon, 1 Oct 2012 01:34:51 -0700 (PDT) Irfan Sayed wrote: > hi, > > i need to delete all blank lines from the text file > How do you define a blank line? Is it an empty line? Is it a line that contains only whitespace? In any case, here are a few comments on your co

Re: delete blank lines from text file

2012-10-01 Thread Kuldeep Dhole
ed to delete all blank lines from the text file > > > wrote following code. however, all the blank lines are not getting > deleted. please suggest > > > open FILE,"+<", 'C:\Users\bvcontrolbuild\Desktop\test.txt'; > > while () >{ >

delete blank lines from text file

2012-10-01 Thread Irfan Sayed
hi, i need to delete all blank lines from the text file wrote following code. however, all the blank lines are not getting deleted. please suggest open FILE,"+<", 'C:\Users\bvcontrolbuild\Desktop\test.txt';  while ()    {     chomp;     push (@lines, &q

Re: Parsing a Text File using regex

2011-08-06 Thread Rob Dixon
On 06/08/2011 15:14, Emeka wrote: John, Thanks for making things pretty simple for mere mortals .. Hi Emeka chomp( my $raw_file = glob "@ARGV" ); I am of the view that glob sub is used for as tree (that is to get all the files in a folder and all its sub-folders. From the above, it see

Re: Parsing a Text File using regex

2011-08-06 Thread Emeka
John, Thanks for making things pretty simple for mere mortals .. >> > chomp( my $raw_file = glob "@ARGV" ); > I am of the view that glob sub is used for as tree (that is to get all the files in a folder and all its sub-folders. From the above, it seems like it could be used for something else.

Re: Parsing a Text File using regex

2011-08-04 Thread Uri Guttman
> "ta" == timothy adigun <2teezp...@gmail.com> writes: ta> I believe you know that in Perl there are more than one way to do ta> it! i.e solve a problem. And that one way is no better than the ta> other, it only depend on what the programmer preferred to use, as ta> long as the syntax

Re: Parsing a Text File using regex

2011-08-04 Thread timothy adigun
Hi John, I believe you know that in Perl there are more than one way to do it! i.e solve a problem. And that one way is no better than the other, it only depend on what the programmer preferred to use, as long as the syntax are correct. Secondly, most of your why would have been answered, if only y

Re: Parsing a Text File using regex

2011-08-04 Thread John W. Krahn
timothy adigun wrote: Hi Ryan, Try the the code below, it should help. === #!/usr/bin/perl -w use strict; my $ln=""; my ($yr,$cat,$win)=("","",""); my $filename="New_output.txt"; chomp(my $raw_file=<@ARGV>); That is the same as saying: chomp( my $raw_file = glob

Re: Parsing a Text File using regex

2011-08-04 Thread Ryan
Timothy, That worked like a charm. Thank you so much for the help. -Ryan On Thu, Aug 4, 2011 at 4:41 AM, timothy adigun <2teezp...@gmail.com> wrote: > Hi Ryan, > Try the the code below, it should help. > > === > > #!/usr/bin/perl -w > use strict; > > my $ln=""; > my ($yr,

Re: Parsing a Text File using regex

2011-08-04 Thread timothy adigun
Hi Ryan, Try the the code below, it should help. === #!/usr/bin/perl -w use strict; my $ln=""; my ($yr,$cat,$win)=("","",""); my $filename="New_output.txt"; chomp(my $raw_file=<@ARGV>); open READFILE,"<","$raw_file" or die "can't open $!"; open OUTPUTFILE,">","$filenam

Parsing a Text File using regex

2011-08-03 Thread Ryan Lagola
Hello, I have been scratching my head on this problem and was wondering if someone can help me out. Basically I need to take a raw list of data (a snippet of it is below my email) and create another file with the information formatted in the following format: "Date: Category: Winner." The example

Re: How to filter out { } block in text file

2010-11-17 Thread Vincent Li
On Wed, Nov 17, 2010 at 3:26 AM, Rob Dixon wrote: > On 16/11/2010 17:01, Vincent Li wrote: >> >> Hi List, >> >> I have a text test.txt file looks like below: >> >> stp instance 0 { >>    interfaces 1.1 { >>          external path cost 2 >>          internal path cost 2 >>       } >>    vla

Re: How to filter out { } block in text file

2010-11-17 Thread Vincent Li
On Wed, Nov 17, 2010 at 3:26 AM, Rob Dixon wrote: > On 16/11/2010 17:01, Vincent Li wrote: >> >> Hi List, >> >> I have a text test.txt file looks like below: >> >> stp instance 0 { >>    interfaces 1.1 { >>          external path cost 2 >>          internal path cost 2 >>       } >>    vla

Re: How to filter out { } block in text file

2010-11-17 Thread Rob Dixon
On 16/11/2010 17:01, Vincent Li wrote: Hi List, I have a text test.txt file looks like below: stp instance 0 { interfaces 1.1 { external path cost 2 internal path cost 2 } vlans { internal vlan10 } } profile http http_global { def

Re: How to filter out { } block in text file

2010-11-16 Thread C.DeRykus
On Nov 16, 1:54 pm, vincent.mc...@gmail.com (Vincent Li) wrote: > On Tue, Nov 16, 2010 at 1:11 PM, Shawn H Corey wrote: > > > On 10-11-16 04:07 PM, Vincent Li wrote: > > >> My aim is to remove specific profile.*{} block from that file > > > Yes, but if the {} blocks are nestable, then you can't do

Re: How to filter out { } block in text file

2010-11-16 Thread Brian Fraser
Assuming your brackets are balanced, here's a drop-in regex for you: /$profile .*? ( #Group 1 { (?: [^{}]+ | (?1) #If not brackets, eat up. Otherwise, recurse on group 1. )*? } ) /gx; Minimally adapted from Anon.'s

Re: How to filter out { } block in text file

2010-11-16 Thread Jim Gibson
On 11/16/10 Tue Nov 16, 2010 2:25 PM, "Vincent Li" scribbled: > On Tue, Nov 16, 2010 at 2:14 PM, Jim Gibson wrote: >> On 11/16/10 Tue  Nov 16, 2010  1:07 PM, "Vincent Li" >> scribbled: >> >>> On Tue, Nov 16, 2010 at 9:38 AM, Jim Gibson wrote: >> You need a parser to do this righ

Re: How to filter out { } block in text file

2010-11-16 Thread Vincent Li
On Tue, Nov 16, 2010 at 2:14 PM, Jim Gibson wrote: > On 11/16/10 Tue  Nov 16, 2010  1:07 PM, "Vincent Li" > scribbled: > >> On Tue, Nov 16, 2010 at 9:38 AM, Jim Gibson wrote: > >>> >>> You need a parser to do this right. You might have some luck by reading the >>> entire file into a scalar varia

Re: How to filter out { } block in text file

2010-11-16 Thread Jim Gibson
On 11/16/10 Tue Nov 16, 2010 1:07 PM, "Vincent Li" scribbled: > On Tue, Nov 16, 2010 at 9:38 AM, Jim Gibson wrote: >> >> You need a parser to do this right. You might have some luck by reading the >> entire file into a scalar variable and using the Text::Balanced module >> together with some

Re: How to filter out { } block in text file

2010-11-16 Thread Vincent Li
On Tue, Nov 16, 2010 at 1:11 PM, Shawn H Corey wrote: > On 10-11-16 04:07 PM, Vincent Li wrote: >> >> My aim is to remove specific profile.*{} block from that file > > Yes, but if the {} blocks are nestable, then you can't do it with regular > expressions alone. > right, I only have one level nes

Re: How to filter out { } block in text file

2010-11-16 Thread Shawn H Corey
On 10-11-16 04:07 PM, Vincent Li wrote: My aim is to remove specific profile.*{} block from that file Yes, but if the {} blocks are nestable, then you can't do it with regular expressions alone. -- Just my 0.0002 million dollars worth, Shawn Programming is as much about organization

Re: How to filter out { } block in text file

2010-11-16 Thread Vincent Li
On Tue, Nov 16, 2010 at 9:38 AM, Jim Gibson wrote: > On 11/16/10 Tue  Nov 16, 2010  9:01 AM, "Vincent Li" > scribbled: > >> Hi List, >> >> I have a text test.txt file looks like below: >> >> stp instance 0 { >>    interfaces 1.1 { >>          external path cost 2 >>          internal path cos

Re: How to filter out { } block in text file

2010-11-16 Thread Jim Gibson
On 11/16/10 Tue Nov 16, 2010 9:01 AM, "Vincent Li" scribbled: > Hi List, > > I have a text test.txt file looks like below: > > stp instance 0 { >interfaces 1.1 { > external path cost 2 > internal path cost 2 > } >vlans { > internal > vlan10

Re: How to filter out { } block in text file

2010-11-16 Thread Shawn H Corey
On 10-11-16 12:01 PM, Vincent Li wrote: how can I find a specific profile { } block and remove/replace that part from the file You will need a Finite-State Automation (FSA) with a push-down stack. -- Just my 0.0002 million dollars worth, Shawn Programming is as much about organization

How to filter out { } block in text file

2010-11-16 Thread Vincent Li
Hi List, I have a text test.txt file looks like below: stp instance 0 { interfaces 1.1 { external path cost 2 internal path cost 2 } vlans { internal vlan10 } } profile http http_global { defaults from http max header size 38912 encryp

Re: 1-line text file with numbers, need to add to them

2010-02-06 Thread 7
e: >> >> > I need some help with this problem. >> > I've got a text file datafile with 1 line of data comprised of 30 >> > different numbers delimited with ~s. >> >> > I need to open this file, grab this line of data, split it into >> > in

Re: 1-line text file with numbers, need to add to them

2010-02-05 Thread Uri Guttman
> "cc" == chaccou...@camcontacts com writes: cc> Please unsubscribe from chaccou...@camcontacts.com and h...@camcontacts.com i don't manage this list. you can follow the directions for subscribing which are in the headers of each email on the list. uri -- Uri Guttman -- u...@stem

Re: 1-line text file with numbers, need to add to them

2010-02-05 Thread Uri Guttman
> "F" == Frank writes: F> #!/usr/bin/perl F> open(DATA,"data.txt"); F> while() { F> $number=$_; F> # print $number; F> while ($number =~ /([0-9]+)~s/g){ F> printf ("%d\n","$1"); F> } F> } F> close(DATA); regardless of the poor code there and others have commen

Re: 1-line text file with numbers, need to add to them

2010-02-05 Thread John W. Krahn
Frank wrote: On Feb 4, 4:35 pm, jwkr...@shaw.ca ("John W. Krahn") wrote: Chris wrote: I need some help with this problem. I've got a text file datafile with 1 line of data comprised of 30 different numbers delimited with ~s. I need to open this file, grab this line of data

Re: 1-line text file with numbers, need to add to them

2010-02-05 Thread Frank
On Feb 4, 4:35 pm, jwkr...@shaw.ca ("John W. Krahn") wrote: > Chris wrote: > > I need some help with this problem. > > I've got a text file datafile with 1 line of data comprised of 30 > > different numbers delimited with ~s. > > > I need to open thi

Re: 1-line text file with numbers, need to add to them

2010-02-05 Thread Chris
On Feb 4, 2:27 am, cacogg...@gmail.com (Chris) wrote: > I need some help with this problem. > I've got a text file datafile with 1 line of data comprised of 30 > different numbers delimited with ~s. > > I need to open this file, grab this line of data, split it into > indi

Re: 1-line text file with numbers, need to add to them

2010-02-05 Thread FrankCai
On Feb 4, 7:27 am, cacogg...@gmail.com (Chris) wrote: > I need some help with this problem. > I've got a text file datafile with 1 line of data comprised of 30 > different numbers delimited with ~s. > > I need to open this file, grab this line of data, split it into > individual

Re: 1-line text file with numbers, need to add to them

2010-02-05 Thread Shlomi Fish
Hi Frank! On Thursday 04 Feb 2010 19:24:41 Frank wrote: > For instance, the below is your data file --data.txt > 12~s1~s314~s5677~s899~s0~s > Here are the codes: > > #!/usr/bin/perl > open(DATA,"data.txt"); > while() { > $number=$_; > # print $number; > while ($number =~ /([0-9]+)~s/g){ >

Re: 1-line text file with numbers, need to add to them

2010-02-05 Thread Frank
); On Feb 4, 7:27 am, cacogg...@gmail.com (Chris) wrote: > I need some help with this problem. > I've got a text file datafile with 1 line of data comprised of 30 > different numbers delimited with ~s. > > I need to open this file, grab this line of data, split it into > individual

Re: 1-line text file with numbers, need to add to them

2010-02-05 Thread Chris
On Feb 4, 10:59 am, shlo...@iglu.org.il (Shlomi Fish) wrote: > Hi Chris! > > Have you visitedhttp://perl-begin.org/yet and read a good introductory book > or tutorial? > > On Thursday 04 Feb 2010 09:27:32 Chris wrote: > > > I need some help with this problem. > > I

Re: 1-line text file with numbers, need to add to them

2010-02-04 Thread John W. Krahn
Chris wrote: I need some help with this problem. I've got a text file datafile with 1 line of data comprised of 30 different numbers delimited with ~s. I need to open this file, grab this line of data, split it into individual numbers, perform some simple math (addition) on each number

Re: 1-line text file with numbers, need to add to them

2010-02-04 Thread Shlomi Fish
Hi Chris! Have you visited http://perl-begin.org/ yet and read a good introductory book or tutorial? On Thursday 04 Feb 2010 09:27:32 Chris wrote: > I need some help with this problem. > I've got a text file datafile with 1 line of data comprised of 30 > different numbers del

1-line text file with numbers, need to add to them

2010-02-04 Thread Chris
I need some help with this problem. I've got a text file datafile with 1 line of data comprised of 30 different numbers delimited with ~s. I need to open this file, grab this line of data, split it into individual numbers, perform some simple math (addition) on each number, and then put th

AW: Edit text file using perl script

2009-07-07 Thread Thomas Bätzler
Alpesh Naik wrote: > Hi Thomas, > and thanks for the reply, > > Given below is my code, > > #!/usr/bin/perl #!/usr/bin/perl -w => You should always enable warnings. > use strict; > > print "Content-type:text/html\n\n"; > use CGI; > my $query = new CGI; => If you're using CGI, then you should

AW: Edit text file using perl script

2009-07-06 Thread Thomas Bätzler
Alpesh Naik asked: > I am trying to edit the text file using perl script. > i want to replace a particular text of file with new text. > > but the problem is that the new text appeared at end of file; > > How can i solve this problem, > pls. help We can help you

Re: Edit text file using perl script

2009-07-06 Thread Chas. Owens
On Tue, Jul 7, 2009 at 02:25, Alpesh Naik wrote: > Hi all, > > I  am trying to edit the text file using perl script. > i want to replace a particular text of file with new text. > > but the problem is that the new text appeared at end of file; > > How can i solve t

Edit text file using perl script

2009-07-06 Thread Alpesh Naik
Hi all, I am trying to edit the text file using perl script. i want to replace a particular text of file with new text. but the problem is that the new text appeared at end of file; How can i solve this problem, pls. help Regards, Alpesh.

Re: copying a webpage and pasting to a text file

2008-12-26 Thread Octavian Rasnita
e: copying a webpage and pasting to a text file I seem to remember that Yahoo Finance has a Web-Services interface that may alloy you to get financial data. The current figured are lagged by about ten minutes or so. Take a look at the Yahoo Developer Network (http://developer.yahoo.com/) for more

Re: copying a webpage and pasting to a text file

2008-12-25 Thread Bob goolsby
, Chas. Owens wrote: > On Tue, Dec 23, 2008 at 11:30, Collaborate wrote: >> I am wondering if there is a way to copy a webpage to a text file >> using Perl. All I need is to copy as unformatted text. >> >> I would like to match certain strings on pages written

Re: copying a webpage and pasting to a text file

2008-12-25 Thread Gunnar Hjalmarsson
Collaborate wrote: On Dec 23, 3:34 pm, nore...@gunnar.cc (Gunnar Hjalmarsson) wrote: Collaborate wrote: I am wondering if there is a way to copy a webpage to a text file using Perl. use LWP::Simple; my $url = 'http://www.example.com/'; open my $fh, '>'

Re: copying a webpage and pasting to a text file

2008-12-25 Thread Chas. Owens
On Wed, Dec 24, 2008 at 22:09, Collaborate wrote: > On Dec 23, 3:34 pm, nore...@gunnar.cc (Gunnar Hjalmarsson) wrote: >> Collaborate wrote: >> > I am wondering if there is a way to copy a webpage to a text file >> > using Perl. >> >> use LWP::Simple; &g

Re: copying a webpage and pasting to a text file

2008-12-24 Thread Collaborate
On Dec 23, 3:34 pm, nore...@gunnar.cc (Gunnar Hjalmarsson) wrote: > Collaborate wrote: > > I am wondering if there is a way to copy a webpage to a text file > > using Perl. > >      use LWP::Simple; >      my $url = 'http://www.example.com/'; >      o

Re: copying a webpage and pasting to a text file

2008-12-24 Thread Jenda Krynicky
From: "Chas. Owens" > On Tue, Dec 23, 2008 at 11:30, Collaborate wrote: > > I am wondering if there is a way to copy a webpage to a text file > > using Perl. All I need is to copy as unformatted text. > > > > I would like to match certain strings on page

Re: copying a webpage and pasting to a text file

2008-12-23 Thread Chas. Owens
On Tue, Dec 23, 2008 at 11:30, Collaborate wrote: > I am wondering if there is a way to copy a webpage to a text file > using Perl. All I need is to copy as unformatted text. > > I would like to match certain strings on pages written in javascript > and to my understanding, www::me

Re: copying a webpage and pasting to a text file

2008-12-23 Thread Gunnar Hjalmarsson
Collaborate wrote: I am wondering if there is a way to copy a webpage to a text file using Perl. use LWP::Simple; my $url = 'http://www.example.com/'; open my $fh, '>', 'webpage.txt' or die $!; print $fh get $url; -- Gunnar Hjalmarsson Em

Re: copying a webpage and pasting to a text file

2008-12-23 Thread Mr. Shawn H. Corey
On Tue, 2008-12-23 at 08:30 -0800, Collaborate wrote: > I am wondering if there is a way to copy a webpage to a text file > using Perl. All I need is to copy as unformatted text. > > I would like to match certain strings on pages written in javascript > and to my understanding, www

copying a webpage and pasting to a text file

2008-12-23 Thread Collaborate
I am wondering if there is a way to copy a webpage to a text file using Perl. All I need is to copy as unformatted text. I would like to match certain strings on pages written in javascript and to my understanding, www::mechnize does not work for this application. -- To unsubscribe, e-mail

Re: Append a text file to an existing text file

2008-09-21 Thread John W. Krahn
NewbeeUnix wrote: On Sep 18, 11:49 am, [EMAIL PROTECTED] (Back9) wrote: Is there a way to append a text file to an existing text file. For example, File A: Jan Feb Mar April ... File B: 10 30 40 20 ... After appending job, the File A would be like below. Jan Feb Mar April ... 10 30 40 20

Re: How to append a text file to an existing text file

2008-09-21 Thread Back9
On Sep 19, 11:31 am, [EMAIL PROTECTED] (John W. Krahn) wrote: > Back9 wrote: > > Hello, > > Hello, > > > Is there a way to append a text file to an existing text file. > > For example, > > File A: > > Jan Feb Mar April ... > > > File B: > &

Re: Append a text file to an existing text file

2008-09-21 Thread NewbeeUnix
On Sep 18, 11:49 am, [EMAIL PROTECTED] (Back9) wrote: > Hello, > > Is there a way to append a text file to an existing text file. > For example, > File A: > Jan Feb Mar April ... > > File B: > 10 30 40 20 ... > > After appending job, the File A would be like below

Re: Append a text file to an existing text file

2008-09-19 Thread Dr.Ruud
Back9 schreef: > Is there a way to append a text file to an existing text file. Yes. -- Affijn, Ruud "Gewoon is een tijger." -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/

Re: How to append a text file to an existing text file

2008-09-19 Thread John W. Krahn
Back9 wrote: Hello, Hello, Is there a way to append a text file to an existing text file. For example, File A: Jan Feb Mar April ... File B: 10 30 40 20 ... After appending job, the File A would be like below. Jan Feb Mar April ... 10 30 40 20 ... open A, '>>', 'F

Re: How to append a text file to an existing text file

2008-09-19 Thread Mr. Shawn H. Corey
On Thu, 2008-09-18 at 10:16 -0700, Back9 wrote: > Hello, > > Is there a way to append a text file to an existing text file. > For example, > File A: > Jan Feb Mar April ... > > File B: > 10 30 40 20 ... > > After appending job, the File A would be like below. &

Re: How to append a text file to an existing text file

2008-09-19 Thread jeff pang
re a way to append a text file to an existing text file. > For example, > File A: > Jan Feb Mar April ... > > File B: > 10 30 40 20 ... > > After appending job, the File A would be like below. > Jan Feb Mar April ... > 10 30 40 20 ... > > TIA > > > -- &g

Append a text file to an existing text file

2008-09-19 Thread Back9
Hello, Is there a way to append a text file to an existing text file. For example, File A: Jan Feb Mar April ... File B: 10 30 40 20 ... After appending job, the File A would be like below. Jan Feb Mar April ... 10 30 40 20 ... TIA -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional

How to append a text file to an existing text file

2008-09-19 Thread Back9
Hello, Is there a way to append a text file to an existing text file. For example, File A: Jan Feb Mar April ... File B: 10 30 40 20 ... After appending job, the File A would be like below. Jan Feb Mar April ... 10 30 40 20 ... TIA -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional

Re: encrypt a text file

2008-09-02 Thread Jeff Pang
> Message du 27/08/08 16:40 > De : "Bryan R Harris" > A : "Beginners Perl" > Copie à : > Objet : Re: encrypt a text file > > > > > > hello, > > > > how to encrypt a text file and decrypt it with perl? > > > > for ex

Re: encrypt a text file

2008-08-27 Thread Bryan R Harris
> hello, > > how to encrypt a text file and decrypt it with perl? > > for example, I have a config file, > > svr.conf > > I want to encrypt it to svr.conf.encrypt. > > But I should also have the ability to decrypt the encryped one to the > original

Re: encrypt a text file

2008-08-27 Thread Dan Baker
[EMAIL PROTECTED] wrote: how to encrypt a text file and decrypt it with perl? for example, I have a config file, svr.conf I want to encrypt it to svr.conf.encrypt. But I should also have the ability to decrypt the encryped one to the original text. when using

Re: encrypt a text file

2008-08-27 Thread Xavier Mas
El Wednesday 27 August 2008 08:28:40 [EMAIL PROTECTED] va escriure: > hello, > > how to encrypt a text file and decrypt it with perl? > > for example, I have a config file, > > svr.conf > > I want to encrypt it to svr.conf.encrypt. > > But I should also have the

encrypt a text file

2008-08-26 Thread practicalperl
hello, how to encrypt a text file and decrypt it with perl? for example, I have a config file, svr.conf I want to encrypt it to svr.conf.encrypt. But I should also have the ability to decrypt the encryped one to the original text. Any suggestion is welcome. thanks. -- To unsubscribe, e

Re: How to replace one line in a text file with Perl?

2008-03-27 Thread John W. Krahn
[ Please do not top-post your replies. TIA ] sanket vaidya wrote: Here is the entire code to accomplish your task. It will delete 1st & 3rd lines. use warnings; use strict; my @array; open FH,"data.txt"; You should *always* verify that the file opened correctly: open FH, '<', 'data.txt' o

RE: How to replace one line in a text file with Perl?

2008-03-27 Thread sanket vaidya
:21 PM To: beginners@perl.org Subject: How to replace one line in a text file with Perl? Hi all, I have a file that looks like: */tmp/dst/file1*234*RW*6790 */tmp/dst/file2*568*RW*908 */tmp/dst/file3*345*RW*746 */test/flm/file4*354*RW*987 */test/flm/file5*643*RW*645 I need to keep all of the lin

RE: How to replace one line in a text file with Perl?

2008-03-27 Thread sanket vaidya
o: beginners@perl.org Subject: How to replace one line in a text file with Perl? Hi all, I have a file that looks like: */tmp/dst/file1*234*RW*6790 */tmp/dst/file2*568*RW*908 */tmp/dst/file3*345*RW*746 */test/flm/file4*354*RW*987 */test/flm/file5*643*RW*645 I need to keep all of the lines with th

Re: How to replace one line in a text file with Perl?

2008-03-26 Thread Gunnar Hjalmarsson
btna wrote: I have a file that looks like: */tmp/dst/file1*234*RW*6790 */tmp/dst/file2*568*RW*908 */tmp/dst/file3*345*RW*746 */test/flm/file4*354*RW*987 */test/flm/file5*643*RW*645 I need to keep all of the lines with the exception of the one with file1 and file3 which have in common "/tmp/dst"

How to replace one line in a text file with Perl?

2008-03-26 Thread btna
Hi all, I have a file that looks like: */tmp/dst/file1*234*RW*6790 */tmp/dst/file2*568*RW*908 */tmp/dst/file3*345*RW*746 */test/flm/file4*354*RW*987 */test/flm/file5*643*RW*645 I need to keep all of the lines with the exception of the one with file1 and file3 which have in common "/tmp/dst". I

Re: Searching text file and printing to new file

2008-01-18 Thread Gunnar Hjalmarsson
<$IN> ) { print $OUT scalar <$IN> if /^findable/; } OK here's what I've got: This (obviously) copies the whole text file. How can I select only certain lines to copy based on either the line above or below it? I suggested a solution. Why do you ignore my sug

Re: Searching text file and printing to new file

2008-01-18 Thread Tri Trinh
On Jan 18, 10:27 am, [EMAIL PROTECTED] (Rob Dixon) wrote: > Gunnar Hjalmarsson wrote: > > [EMAIL PROTECTED] wrote: > >> On Jan 14, 5:08 pm, [EMAIL PROTECTED] (Gunnar Hjalmarsson) wrote: > >>> [EMAIL PROTECTED] wrote: > >>>> I have a large text file wi

Re: Searching text file and printing to new file

2008-01-18 Thread Rob Dixon
Gunnar Hjalmarsson wrote: [EMAIL PROTECTED] wrote: On Jan 14, 5:08 pm, [EMAIL PROTECTED] (Gunnar Hjalmarsson) wrote: [EMAIL PROTECTED] wrote: I have a large text file with information essentially broken into lines like this: findable text with a regexp information I care about more findable

Re: Searching text file and printing to new file

2008-01-17 Thread Gunnar Hjalmarsson
[EMAIL PROTECTED] wrote: On Jan 14, 5:08 pm, [EMAIL PROTECTED] (Gunnar Hjalmarsson) wrote: [EMAIL PROTECTED] wrote: I have a large text file with information essentially broken into lines like this: findable text with a regexp information I care about more findable text There are plenty of

Re: Searching text file and printing to new file

2008-01-17 Thread PlagueMagazine
; Really? Which things specifically, and in what way? > > > I have a large text file with > > information essentially broken into lines like this: > > > findable text with a regexp > > information I care about > > more findable text > > > There are plenty

Re: Searching text file and printing to new file

2008-01-14 Thread Gunnar Hjalmarsson
[EMAIL PROTECTED] wrote: I'm a nearly absolute beginner to Perl, Then this site ought to be useful: http://learn.perl.org/ and a lot of the text manipulation things confuse me. Really? Which things specifically, and in what way? I have a large text file with information essent

Searching text file and printing to new file

2008-01-14 Thread PlagueMagazine
I'm a nearly absolute beginner to Perl, and a lot of the text manipulation things confuse me. I have a large text file with information essentially broken into lines like this: findable text with a regexp information I care about more findable text There are plenty of sections like this i

Re: values of DBI statement handle not getting written into text file

2008-01-02 Thread Tom Phoenix
On Jan 2, 2008 6:21 AM, Siva Prasad <[EMAIL PROTECTED]> wrote: > I have a problem printing values of DBI statement handle into a text file. I have a problem reading your message, since it's all blue. Please, don't do that. > If I print the values in statement handle on t

values of DBI statement handle not getting written into text file

2008-01-02 Thread Siva Prasad
Hi gurus, I have a problem printing values of DBI statement handle into a text file. The detail problem is as bellows: I am sending a query to one of the subroutines of a package and getting the statement handle with return statement If I print the values in statement

Re: Effective search of text file

2007-12-12 Thread Dr.Ruud
John W . Krahn schreef: > Dr.Ruud: >> my $filename = "test.db"; >> open my $fd, "<", $filename >> or die "'$filename': $!"; >> >> (yes, I prefer Texan quotes nowadays :) > > Is that Dutch slang? I have never heard that expression before. I paraphrased on a recent discussion in p6lang.

Re: Effective search of text file

2007-12-12 Thread Chas. Owens
On Dec 12, 2007 8:46 AM, John W. Krahn <[EMAIL PROTECTED]> wrote: > On Wednesday 12 December 2007 04:03, Dr.Ruud wrote: snip > > or die "'$filename': $!"; > > > > (yes, I prefer Texan quotes nowadays :) > > Is that Dutch slang? I have never heard that expression before. > snip Some people c

Re: Effective search of text file

2007-12-12 Thread John W . Krahn
On Wednesday 12 December 2007 04:03, Dr.Ruud wrote: > jeff pang schreef: > > open FD,"test.db" or die $!; > > Jeff, could you please start using lexical filehandles, more > whitespace, and 3-argument opens, when publishing example code on > this list? > > my $filename = "test.db"; > open my $fd

Re: Effective search of text file

2007-12-12 Thread Chas. Owens
On Dec 12, 2007 8:12 AM, jeff pang <[EMAIL PROTECTED]> wrote: > > --- "Chas. Owens" <[EMAIL PROTECTED]> wrote: > > The only reason to use any version earlier than 5.6.3 > > is > > that your sysadmins won't upgrade an ancient box (and even then it > > is > > time to quit that job because if they are

Re: Effective search of text file

2007-12-12 Thread jeff pang
--- "Chas. Owens" <[EMAIL PROTECTED]> wrote: > The only reason to use any version earlier than 5.6.3 > is > that your sysadmins won't upgrade an ancient box (and even then it > is > time to quit that job because if they are that stupid then there > are > probably other issues as well). > mhh? if

Re: Effective search of text file

2007-12-12 Thread Chas. Owens
On Dec 12, 2007 7:30 AM, jeff pang <[EMAIL PROTECTED]> wrote: snip > I'd like. But I learned perl from 2002 year, I even don't know what's > perl 4. snip Some features you would have to stop using: * lexical variables (i.e. my) * multidimensional arrays and nested hashes * real (vs symbolic) refer

  1   2   3   4   5   6   7   >