I use the following code to searches for the .java scripts and print the date line (1999 - 2002) to see how many scrpts out of date. What I would like is to adapt this to change the copyright.
my $root = 'f:/'; my %hash = (); # # main # { my @files = getFileList(); # find files within given vobs my $n = @files ; print STDERR "Searching $n files\n" ; my $n = 0 ; foreach my $f (@files) # open found files { $n++ ; print STDERR "$n\r" ; unless (open( SRC, $f )) { print STDERR "Unable to open $f: $!\n" ; next ; } while (<SRC>) { last if (/^\s*package/); #next unless (/\$Workfile/m); # get filename next unless (/copyright.*application/i); # get copyright chomp ; # remove newline s/^\s*\*//; # remove comments s/\s+/ /; # multiple whitespace into single whitespac +e s/^\s+// ; # remove any leading whitespace s/\s+$// ; # remove any trailing whitespace $hash{ $_ }++; last ; } close (SRC); } foreach my $k (sort keys %hash) { my $v = $hash{ $k }; #print STDERR "$v: $k\n" ; print STDERR "$_\n" ; } } my @theFiles = (); sub getFileList() { my @files = (); foreach my $k ("dir1", "dir2") { @theFiles = (); find( \&wanted, "$view/$k/src" ); push @files, @theFiles ; } return @files ; } sub wanted { return unless (-f $_ ); return unless ($_ =~ /\.java$/); push @theFiles, $File::Find::name ; }

In reply to Re: Re: Search and replace copyright to .java scripts by Anonymous Monk
in thread Search and replace copyright to .java scripts by knobbled

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.