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

Re^2: Delete specific lines from txt file.

by FredFredFred (Initiate)
on Aug 07, 2012 at 23:15 UTC ( #986101=note: print w/replies, xml ) Need Help??


in reply to Re: Delete specific lines from txt file.
in thread Delete specific lines from txt file.

hmm, that sounds good, but I have no clue how to do it... Can you provide some code? Thanks

  • Comment on Re^2: Delete specific lines from txt file.

Replies are listed 'Best First'.
Re^3: Delete specific lines from txt file.
by roboticus (Chancellor) on Aug 09, 2012 at 21:02 UTC

    FredFredFred:

    # Discard every other line open FIN, 'INFILE' or die; open FOUT, '>INFILE.new' or die; my $cnt; while (<FIN>) { next if $cnt%2; print FOUT; } close FH; close FOUT; rename 'INFILE', 'INFILE.bak'; rename 'INFILE.new', 'INFILE;

    ...roboticus

    When your only tool is a hammer, all problems look like your thumb.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://986101]
help
Chatterbox?
[Discipulus]: might be it is necessary to pass the pic data like MIME::Base64:: encode( data..
[Discipulus]: if you have a jpeg data: or as wise Corion said IM ca n read directly your handle
[Corion]: Meh. I get the feeling I should post a call-to-action for people to test their modules with the upcoming 5.26 (or 5.25.latest), as it seems that the smoke testers don't really weed out modules that fail without . in @INC
[Corion]: But without instructions on how to easily test things yourself, I don't think such a call to arms is helpful
[Corion]: (this post on nntp.perl.org / p5p makes it seem to me that smoke testers seem to have a blind spot there)

How do I use this? | Other CB clients
Other Users?
Others about the Monastery: (8)
As of 2017-03-27 08:00 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Should Pluto Get Its Planethood Back?



    Results (317 votes). Check out past polls.