How To Modify Files Inline Using PERL Edit In Place
erics, Posted July 8th, 2020 at 3:57:44pm
1 2 3 4 5 6 7 8 9 10 11 12 |
my $stamp = strftime "%Y%m%d%H%M%S", gmtime time; ## in-place update for the file our $^I = ".$stamp"; local @ARGV = ($fullpath); while ( <ARGV> ) { if (/$regex/) { next; } # this print is the critical part to write the line back to the file print; } $^I = undef; |
Categories: How-To's, Technology Tags: Change, Edit, Edit In Place, howto, in place, Inline, modify, perl, Place, Script, tips
S | M | T | W | T | F | S |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | |||
5 | 6 | 7 | 8 | 9 | 10 | 11 |
12 | 13 | 14 | 15 | 16 | 17 | 18 |
19 | 20 | 21 | 22 | 23 | 24 | 25 |
26 | 27 | 28 | 29 | 30 | 31 |
Copyright © 2005-2024 Eric Michael Stone | Random Thoughts, Whims and Fancies…. Powered by WordPress
Leave Your Comment
All fields marked with "*" are required.