Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re: Delete Lines Across Multiple Files

by tybalt89 (Monsignor)
on Jan 01, 2021 at 15:37 UTC ( [id://11126081]=note: print w/replies, xml ) Need Help??


in reply to Delete Lines Across Multiple Files

Alternate with "missing file" protection.

#!/usr/bin/perl use strict; use warnings; use Path::Tiny; my $delroad = 'Some Road Name'; my $delnumber = 123; for my $file ( qw( file1 file2 ... file3 ) ) # your filenames here { eval { path($file)->edit_lines( sub { my @field = split /:|\n/; $field[1] eq $delroad && $field[2] == $delnumber and $_ = ''; } ); 1; } or print $@; }

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11126081]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others taking refuge in the Monastery: (3)
As of 2024-04-19 04:18 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found