shadowm

Untitled

May 12th, 2011
259
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Perl 0.25 KB | None | 0 0
  1. #!/usr/bin/perl
  2. foreach(@ARGV) {
  3.     open IN, '<', $_
  4.         or die "Cannot open $_";
  5.     open OUT, '>', "$_.new"
  6.         or die "Cannot create $_.new";
  7.  
  8.     while(<IN>) {
  9.         s/foo/bar/;
  10.         ...
  11.         print OUT $_;
  12.     }
  13.  
  14.     close IN;
  15.     close OUT;
  16.  
  17.     rename "$_.new" "$_";
  18. }
Advertisement
Add Comment
Please, Sign In to add comment