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.
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.
|