diff options
author | Hieu Hoang <hieuhoang@gmail.com> | 2012-05-17 20:59:48 +0400 |
---|---|---|
committer | Hieu Hoang <hieuhoang@gmail.com> | 2012-05-17 20:59:48 +0400 |
commit | 776dd7856e505f8ff92c55e33f31e4304d23092a (patch) | |
tree | 07d53d83a5fad012dcba7dd7f1e49ff85e675129 /scripts/generic/reverse-alignment.perl | |
parent | 4888e114edbd787802a5a7892105f31124c640f4 (diff) |
add script to reverse word alignment
Diffstat (limited to 'scripts/generic/reverse-alignment.perl')
-rwxr-xr-x | scripts/generic/reverse-alignment.perl | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/scripts/generic/reverse-alignment.perl b/scripts/generic/reverse-alignment.perl new file mode 100755 index 000000000..e19ddc9e5 --- /dev/null +++ b/scripts/generic/reverse-alignment.perl @@ -0,0 +1,20 @@ +#!/usr/bin/perl -w + +use strict; + +my $line; +while ($line = <STDIN>) +{ + chomp($line); + my @toks = split(/ /, $line); + + foreach (my $i = 0; $i < @toks; ++$i) + { + my $tok = $toks[$i]; + my @alignPair = split(/-/, $tok); + (@alignPair == 2) or die("Something wrong"); + print $alignPair[1]."-".$alignPair[0]." "; + } + print "\n"; +} + |