in reply to in place editing a list of files
But I'm not sure why you don't just put all the filenames in @ARGV:
It's possible you are having file permission problems, in which case, you are probably better off not relying on $^I but instead explicitly renaming each file and opening the old and new names, checking each operation for success and giving a meaningful error message on failure.#!/usr/bin/perl use strict; use warnings; #edit contains the complete path of the files to be edited my $path = "./edit" ; #geting a file handler open(FL, "$path"); #getting all the file names in the @ARGV so that i can process them chomp(@ARGV = <FL>); # $INPUT_RECORD_SEPARATOR $/=""; # $INPLACE_EDIT $^I=".bak"; while(<>) { s/CONFIDENTIAL(.*?)own\s+risk/ /sm; print ; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: in place editing a list of files
by liverpole (Monsignor) on Jan 07, 2007 at 18:59 UTC | |
|
Re^2: in place editing a list of files
by rjsaulakh (Beadle) on Jan 08, 2007 at 18:05 UTC | |
by ysth (Canon) on Jan 09, 2007 at 04:27 UTC |