hb_sz 发表于 2018-9-1 06:53:49

perl中替换文本一例

#!/usr/bin/perl  while(){
  chomp;
  @line=split(/\s+/,$_);
  open FH,"< /home/test/$line/wp-config.php";
  my @webfile;
  while(){
  s/(ME|ER)', 'root/$1', '$line/g;
  push @webfile,$_;
  }
  close FH;
  open FH,"> /home/test/$line/wp-config.php";
  print FH for @webfile; #相当于foreach $mm (@webfile){

页: [1]
查看完整版本: perl中替换文本一例