Guest User

Untitled

a guest
Jun 17th, 2018
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.93 KB | None | 0 0
  1. #!/bin/perl
  2. #!/usr/local/ActivePerl-5.6/bin/perl -w
  3.  
  4. $infile = $ARGV[0];
  5. $outfile = "$infile.dc";
  6. $index = 0;
  7.  
  8. open (OUT, ">$outfile" );
  9.  
  10. $index = 0;
  11. open (INF, "$infile") || die (" can not open input file n" );
  12. print "============After open infile=====================n";
  13. while(<INF>) {
  14. if($_ =~ /$index/ )
  15. {
  16. chomp $_;
  17. @temp2 = split (/s+/,$_);
  18. printf OUT (@temp2);
  19. # printf OUT ("%-10s %7d %s %7.2f %s %7d %s n",
  20. # $temp2[5],$temp2[7], $temp2[8], $temp2[9], $temp2[10], $temp2[11], $temp2[12]);
  21. }
  22.  
  23. if ($index < 2000) { $index = $index +1;}
  24. else {$index = 2000;}
  25.  
  26. } # whole
  27. # } # for
  28.  
  29. close (INF) || die "cannot close input file !!";
  30. close (OUT);
  31. #rename("$outfile1", "$infile.txt");
  32. print " data is in $outfile. nn";
Add Comment
Please, Sign In to add comment