Hi,
I have a series of files.
$ cat text_1.xvg
0 0 1 2 3
2 1 0 2 3
4 1 2 0 3
$ cat text_2.xvg
0 0 1 2 3
2 1 0 3 2
4 1 3 0 2
I wish to translate the text_2 numbers (except the first field) based on
the last line of the text_1.xvg
namely text_2.xvg will become:
0 1 2 0 3
2 2 1 3 0
Here is what I Have came up so far,
#!/usr/bin/env perl
use strict;
use warnings;
use autodie qw(open close);
use 5.012;
my $dict = system("tail -n 1 text_1.xvg");
print $dict;
print "\n\n";
open my $fh, "<","text_2.xvg";
while(<$fh>){
print $_;
}
./re_number.pl
4 1 2 0 3
0 ## but the last line got an extra 0,
0 0 1 2 3
2 1 0 3 2
4 1 3 0 2
Thanks ahead for the suggestions,
Best regards,
--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/