Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Re: doing a search and replace on a large file

by pelagic (Priest)
on Apr 14, 2004 at 12:48 UTC ( #345028=note: print w/replies, xml ) Need Help??


in reply to doing a search and replace on a large file

An example how I skip on a couple of conditions:
use strict; my ($inputfile, $outputfile) = @_; open (OUT, ">$outputfile") || die "could not open $outputfile\n"; open (IN, "<$inputfile") || die "could not open $inputfile\n"; while (<IN>) { chomp; # no newline s/^--.*//; # no oracle comments s/^prompt.*//; # no oracle prompt lines s/^\s+//; # no leading white s/\s+$//; # no trailing white s/\s+/ /; # replace series of white with one spac +e next unless length; # anything left? print OUT $_, "\n"; } close IN; close OUT;

pelagic

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://345028]
help
Chatterbox?
Corion idly wonders about creating a series of HTTP requests. There seems to be no framework to generate a series of HTTP requests, like "try all these requests"
[Corion]: This is vaguely inspired by that list of "nasty" strings, which I'd like to replace among HTTP parameters, just to see whether the application crashes, but also for easy downloading of a list of URLs etc
[Corion]: Maybe I'll just conoct something using Algorithm::Permute to create an (OO) generator for such requests, or a simple function.

How do I use this? | Other CB clients
Other Users?
Others wandering the Monastery: (9)
As of 2017-01-16 15:36 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Do you watch meteor showers?




    Results (151 votes). Check out past polls.