Last active
August 29, 2015 14:13
-
-
Save JustinMcNamara74/4c872b7b9a9eb9902486 to your computer and use it in GitHub Desktop.
#PERL Counts each "|" denoting a new column, and outputs the first 10 columns per line.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env perl | |
while (my $row = <>) { | |
chomp $row; | |
my $num_of_pipes = $row =~ tr/|//; | |
while (($num_of_pipes < 10) && ($num_of_pipes > 0)) { | |
my $next_line = <>; | |
$row .= $next_line; | |
$num_of_pipes = $row =~ tr/|//; | |
} | |
print $row."\n"; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment