Adjust Thresholds

cat s3r0p6.dat | perl -ne 'next if (/^#/);  ($a, $b)=$_=~/(\d+) (\d+)/; if($b<1023) {$b=1023}; print "$a $b\n"' > s3r0p6.dat_all_1023


postion: sep03/slow/race/adjust_thresholds_files.pl


#!/usr/bin/perl -w

use strict;
use FileHandle;

my @files = @ARGV;

foreach my $fn (@files) {

    my $fh = FileHandle->new("<$fn");

    my @file = <$fh>;

    $fh->close();

    my $num_lines = scalar @file;
    my $line_counter = 0;
    
    my $fh_out = FileHandle->new(">$fn");
    my $date = qx(date);
    chomp $date;
    print $fh_out "# file changed by adjust_thresholds_files.pl, $date , mt\n";

    foreach my $cur_line (@file) {
      if ($cur_line=~/^#/) {
        print $fh_out $cur_line;
        next;
      }
      ($a, $b)=$cur_line=~/(\d+) (\d+)/; 
      #if($b<1023) {$b=1023}; print "$a $b\n"'

      $line_counter ++;
      
     
      #if($line_counter < $num_lines/2) {
          $b+=1 if($b<1022);
          #$b-=1 if($b>0);
      #}

      $b=1023 if($b>=1024);
      print $fh_out "$a $b\n";
    }

    $fh_out->close();

  }



-- MichaelTraxler - 15 Apr 2005
Topic revision: r2 - 2005-07-13, MichaelTraxler
Copyright © by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding Foswiki Send feedback | Imprint | Privacy Policy (in German)