Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/perl -n
- if ($. % 4 == 1) {
- chomp;
- $block1 = $_;
- }
- elsif ($. % 4 == 2) {
- chomp;
- $block2 = $_;
- }
- elsif ($. % 4 == 3) {
- chomp;
- $block3 = $_;
- }
- elsif ($. % 4 == 0) {
- chomp;
- $block4 = $_;
- print "$block1 $block3\n$block2 $block4\n";
- # Clean blocks
- $block1 = "";
- $block2 = "";
- $block3 = "";
- $block4 = "";
- }
- END {
- # Print out remaining blocks
- if ($. % 4 != 0) {
- print "$block1 $block3\n$block2 $block4\n";
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement