Προς το περιεχόμενο

allagh enos string se polla arxeia


dominant

Προτεινόμενες αναρτήσεις

mporw na sou dwsw apantish sto linux an tixon to exeis... h' mporeis na xrisimopoihseis kapoio live cd:

 

1. kane ena backup twn arxeiwn sou.

2. pigaine sto fakelo pou exei ta 10000 arxeia.

3. estw oti ta arxeia exoun pattern file*.php

4. estw oti theleis to counter() na allaksei se counter_new()

5. ektelese sto termatiko (bash) to parakatw :

 

for i in $( ls file*.php ); do replace "counter()" "counter_new()" "counter()" "counter_new()" -- $i; done

 

se mia seira ...

 

elpizw na boithisa....

:)

hayzel

Συνδέστε για να σχολιάσετε
Κοινοποίηση σε άλλες σελίδες

file dominant,

eiha to idio provlima alla me arheia cgi :)

eftiaxa ena script loipon se perl pou kanei afti ti douleia

 

arhika sou zitaei "file to find : " ,ekei valtou afto -> \.php

meta "dir to start : ", dwstou to dit me ena "\" sto telos

meta sou zitaei "palia lexi" (i protasi pou tha adikatastathei)

kai meta "nea lexi" (i protasi pou tha bei sti thesi tis palias)

 

prin to hrisimopoiiseis kane ena backup!!! (POLY SIMADIKO)

tin eiha pathei arhika alla eftihws vrika tropo na to epanaferw...

 

to mono pou tha prepei na prosexeis einai na hrisimopoieis to escape char "\" sto input pou dineis stin palia lexi..

 

px. an thes na adikatastiseis to keimeno "counter()" tote eisai ok

an omws thes na adikatastiseis to keimeno " counter("a") " tote tha prepei na to grapseis etsi : counter(\"a\")

to idio simvainei kai me haraktires opws ".","*","$","\" klp ...

 

loipon, afto einai to DIORTHWMENO script to opoio koitaei kai se ypokatalogous :

 

>
#!/usr/bin/perl

use File::Copy;


print "windows users use \"/\" instead of \"\\\"\n";
print "  ex. c:/\n";
print "always add a \"/\" at the and of starting directory!\n\n";

print "File to find : ";  chomp($file=<>);
print "Dir to start : ";  chomp($dir=<>);
print "Palia lexi   : ";  chomp($old=<>);
print "Nea lexi     : ";  chomp($new=<>);

if ($dir !~ /\/$/) {
 print "Starting dir must end with a \"/\" ...\n";
 exit;
}

$found=0;
$total=0;

print "Starting directory : \"$dir\" ...\n";
print "  Searching for file \"$file\" ...\n\n";

&checkup($file,$dir);

print "\nFiles found : $total\n";


sub checkup {
 my ($fl,$nd)=@_;
 my $file1;

 if (opendir DIR, $nd) { 
   my @files=readdir(DIR);

   foreach $file1 (@files) {
     if (($file1 !~ /^\.*$/)&&($file1 =~ /$fl/i)) {
       &found_it($nd,$file1);
     }
   }
     
   foreach $file1 (@files) {
     if ($file1 !~ /^\.*$/) {
       if (-d $nd.$file1) {
         $temp=$nd . $file1 . "/";
         &checkup($fl,$temp);
       }
     }
   }
 }
 else {
   push(@na,$nd);
 }
}

sub found_it {

       my ($mydir,$file) = @_;

$total++;
       print "--- Processing file \"$mydir$file\"...  ";

open(F,"$mydir$file") || die "\nError opening \"$mydir$file\" ...\n";
open(F2,">xxxtemp.qwe");
while ($line=<F>) {
  $line =~ s/$old/$new/g;
  print F2 "$line";
}
close(F);
close(F2);
move("xxxtemp.qwe","$mydir$file");

print "OK\n";


       $total++;
}

Συνδέστε για να σχολιάσετε
Κοινοποίηση σε άλλες σελίδες

Αρχειοθετημένο

Αυτό το θέμα έχει αρχειοθετηθεί και είναι κλειστό για περαιτέρω απαντήσεις.

  • Δημιουργία νέου...