夜勿眠 发表于 2018-9-1 07:25:13

perl 匹配某行后添加字符串

#!/usr/bin/perl  ## Copyright (c) 2011 by mcshell
  my %do_these;
  foreach (@ARGV) {
  $do_these{$_}=1;
  }
  while (){
  if(/^## Copyright /){
  delete $do_these{$ARGV};#如果存在就删除它
  }
  }
  @ARGV= sort keys %do_these;
  $^I=".mc";
  while (){
  if(/^#!/){
  $_ .= "## Copyright (c) 2011 by mcshell\n";
  }
  print;
  }

页: [1]
查看完整版本: perl 匹配某行后添加字符串