You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by co...@apache.org on 2001/06/06 08:51:29 UTC

cvs commit: jakarta-tomcat-jasper/jasper34/tools importRpl.pl pkgReplace.pl rmImport.pl

costin      01/06/05 23:51:29

  Added:       jasper34/tools importRpl.pl pkgReplace.pl rmImport.pl
  Log:
  Ok, kill me - I used perl to avoid typing. Checked it in - might need it
  later.
  
  Revision  Changes    Path
  1.1                  jakarta-tomcat-jasper/jasper34/tools/importRpl.pl
  
  Index: importRpl.pl
  ===================================================================
  #!/usr/bin/perl
  
  # Replace the "package" declaration
  
  my $file = $ARGV[0];
  my $temp = "temp";
  open (FILE, $file) || die ("Can't open file $file :$! \n");
  
  open (TEMP, ">$temp") || die( "Can't open file $file: $!\n");
  
  while (<FILE>) {
  
    s/import\s+($ARGV[1])\;/import\ $ARGV[2]\;/g;
    print TEMP;
  
  }
  
  
  close(FILE);
  close(TEMP);
  rename($temp, $file);
  
  
  
  1.1                  jakarta-tomcat-jasper/jasper34/tools/pkgReplace.pl
  
  Index: pkgReplace.pl
  ===================================================================
  #!/usr/bin/perl
  
  # Replace the "package" declaration
  
  my $file = $ARGV[0];
  my $temp = "temp";
  open (FILE, $file) || die ("Can't open file $file :$! \n");
  
  open (TEMP, ">$temp") || die( "Can't open file $file: $!\n");
  
  while (<FILE>) {
  
    s/package\s+(\S+)\;/package\ $ARGV[1]\;/g;
    print TEMP;
  
  }
  
  
  close(FILE);
  close(TEMP);
  rename($temp, $file);
  
  
  
  1.1                  jakarta-tomcat-jasper/jasper34/tools/rmImport.pl
  
  Index: rmImport.pl
  ===================================================================
  #!/usr/bin/perl
  
  # Replace the "package" declaration
  
  my $file = $ARGV[0];
  my $temp = "temp";
  open (FILE, $file) || die ("Can't open file $file :$! \n");
  
  open (TEMP, ">$temp") || die( "Can't open file $file: $!\n");
  
  while (<FILE>) {
  
    s/import\s+($ARGV[1])\;//g;
    print TEMP;
  
  }
  
  
  close(FILE);
  close(TEMP);
  rename($temp, $file);
  
  
  

Re: cvs commit: jakarta-tomcat-jasper/jasper34/tools importRpl.pl pkgReplace.pl rmImport.pl

Posted by brian moseley <bc...@maz.org>.
may i suggest something like:

  find . -name "*.java"|xargs perl -pie 's/import\s+foo\;/import\ bar\;/g'

:)

On 6 Jun 2001 costin@apache.org wrote:

> costin      01/06/05 23:51:29
>
>   Added:       jasper34/tools importRpl.pl pkgReplace.pl rmImport.pl
>   Log:
>   Ok, kill me - I used perl to avoid typing. Checked it in - might need it
>   later.
>
>   Revision  Changes    Path
>   1.1                  jakarta-tomcat-jasper/jasper34/tools/importRpl.pl
>
>   Index: importRpl.pl
>   ===================================================================
>   #!/usr/bin/perl
>
>   # Replace the "package" declaration
>
>   my $file = $ARGV[0];
>   my $temp = "temp";
>   open (FILE, $file) || die ("Can't open file $file :$! \n");
>
>   open (TEMP, ">$temp") || die( "Can't open file $file: $!\n");
>
>   while (<FILE>) {
>
>     s/import\s+($ARGV[1])\;/import\ $ARGV[2]\;/g;
>     print TEMP;
>
>   }
>
>
>   close(FILE);
>   close(TEMP);
>   rename($temp, $file);
>
>
>
>   1.1                  jakarta-tomcat-jasper/jasper34/tools/pkgReplace.pl
>
>   Index: pkgReplace.pl
>   ===================================================================
>   #!/usr/bin/perl
>
>   # Replace the "package" declaration
>
>   my $file = $ARGV[0];
>   my $temp = "temp";
>   open (FILE, $file) || die ("Can't open file $file :$! \n");
>
>   open (TEMP, ">$temp") || die( "Can't open file $file: $!\n");
>
>   while (<FILE>) {
>
>     s/package\s+(\S+)\;/package\ $ARGV[1]\;/g;
>     print TEMP;
>
>   }
>
>
>   close(FILE);
>   close(TEMP);
>   rename($temp, $file);
>
>
>
>   1.1                  jakarta-tomcat-jasper/jasper34/tools/rmImport.pl
>
>   Index: rmImport.pl
>   ===================================================================
>   #!/usr/bin/perl
>
>   # Replace the "package" declaration
>
>   my $file = $ARGV[0];
>   my $temp = "temp";
>   open (FILE, $file) || die ("Can't open file $file :$! \n");
>
>   open (TEMP, ">$temp") || die( "Can't open file $file: $!\n");
>
>   while (<FILE>) {
>
>     s/import\s+($ARGV[1])\;//g;
>     print TEMP;
>
>   }
>
>
>   close(FILE);
>   close(TEMP);
>   rename($temp, $file);
>
>
>
>