Last active
October 27, 2020 16:42
-
-
Save jadonk/793f0c4f45a53f30bd587f569f4582f7 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 | |
my $devices = `i2cdetect -y -r 2`; | |
#print $devices; | |
my @lines = split /\n/, $devices; | |
foreach my $line ( @lines ) { | |
next if $line =~ /^\s/; # skip lines starting with whitespace | |
$line =~ s/\d\d\:\s*//; # remove 2 digit indexes | |
#print $line , "\n"; | |
my @entries = split /\s/, $line; | |
foreach my $entry ( @entries ) { | |
next if $entry =~ /\-\-/; # skip entries that that are "--" | |
print $entry , "\n"; | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment