Created
April 2, 2015 15:44
-
-
Save anonymous/2ebb0441bcdec4a94e48 to your computer and use it in GitHub Desktop.
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 | |
use strict; | |
use warnings; | |
# NOTE This assumes the space aren't tabs and the columns are aligned | |
my $input = ' | |
SCGR SC DEV DEV1 NUMDEV DCP STATE REASON | |
1 0 31 1 | |
SCGR SC DEV DEV1 NUMDEV DCP STATE REASON | |
2 0 31 1 | |
'; | |
my @input_lines = split /\n/, $input; | |
foreach my $line (@input_lines) { | |
next unless $line; | |
my $dev = substr($line, 10, 15); | |
$dev =~ s/\s*//g; | |
unless ($dev) { | |
$line =~ s/(..........)(.....)/$1UNDEF/; | |
} | |
print $line."\n"; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment