i have a file called edit where a list of file paths is given and in each of the file given in the path i need to match for multiple lines and delete them if they are there and save the file with the same file name . i have written a piece of code that works fine individually when $path is set to individual file but when i have file named edit contains multipe file path this script doesnt seem to do anything when it reaches the internal while loop . please let me know if i m doing some wrong
#!/usr/bin/perl #edit contains the complete path of the files to be edited my $path = "/home/rjs/heena/edit" ; #geting a file handler open(FL, "$path"); #getting all the file names in the @array so that i can process the fi +le one by one my @array = <FL>; while ( my $array = shift @array) { my $file = $array; @ARGV = ($file); # $INPUT_RECORD_SEPARATOR $/=""; # $INPLACE_EDIT $^I=".bak"; print "all fine \n "; while(<>) { # nothing seems to happen after this piece of code s/CONFIDENTIAL(.*?)own\s+risk/ /sm; print ; } }
a sample view of the file
/********************************************************************* +********/ /* + */ /* Copyright (c) 1996 - 2003 + */ /* Campaco Systems, Inc. + */ /* + */ /* All Rights Reserved + */ /* + */ /* CONFIDENTIAL and PROPRIETARY -- + */ /* No Dissemination or use without prior written permission + */ /* + */ /* Permission to use, copy, modify, distribute and sell this software +and */ /* its documentation for any purpose is hereby prohibited, unless gran +ted */ /* an explicit permission from Campaco Systems, and provided that the +above */ /* copyright notice appears in all copies and that both that copyright + */ /* notice and this permission notice appear in supporting documentatio +n. */ /* + */ /* Campaco Systems makes no representations about the suitability of t +his */ /* software for any purpose. + */ /* It is provided "as is" without express or implied warranty. Modific +ation */ /* of the code is allowed at the modifier's own risk.
In reply to in place editing a list of files by rjsaulakh
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |