unix:chromeos:systemreport
Differences
This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
unix:chromeos:systemreport [2023/07/04 15:29] – created rodolico | unix:chromeos:systemreport [2023/07/04 17:06] (current) – rodolico | ||
---|---|---|---|
Line 18: | Line 18: | ||
- Save as your_nameChrome.pdf (ie, RodChrome.pdf) | - Save as your_nameChrome.pdf (ie, RodChrome.pdf) | ||
- | You now have two large files in your downloads folder, and mhtml file and a PDF. The following Perl script parses the mhtml file, using ====CATEGORY==== as headers, with the contents afterwards. I have written it to NOT include the logs. Use the command: | + | You now have two large files in your downloads folder, and mhtml file and a PDF. The following Perl script parses the mhtml file, using ====CATEGORY==== as headers, with the contents afterwards. I have written it to NOT include the logs. |
- | <code bash> | + | |
+ | Note: The mhtml output uses Windows line endings, so if you're running this on a Unix machine, you'll want to run it through tr to get convert it to Unix line endings. | ||
+ | Use the command: | ||
+ | <code bash>tr -d ' | ||
+ | |||
+ | <code perl processChrome.pl> | ||
+ | #! / | ||
+ | |||
+ | use strict; | ||
+ | use warnings; | ||
+ | |||
+ | # tr -d ' | ||
+ | |||
+ | # anything matching these keys will be include, and all else | ||
+ | # will be excluded. If empty, will include everything not | ||
+ | # matching $ignoreKeys. In this case, we've commented out | ||
+ | # everything, so it will output everything not ignored | ||
+ | my %lookFor = ( | ||
+ | # ' | ||
+ | # ' | ||
+ | # ' | ||
+ | # ' | ||
+ | # ' | ||
+ | # ' | ||
+ | # ' | ||
+ | # ' | ||
+ | # ' | ||
+ | # ' | ||
+ | # ' | ||
+ | # ' | ||
+ | ); | ||
+ | |||
+ | # anything matching this regex will be ignored | ||
+ | # this matches anything with log, profile or ui-heirarchy in | ||
+ | # the key. NOTE: match is case insensitive | ||
+ | my $ignoreRegex = qr' | ||
+ | |||
+ | |||
+ | # get a single line. This is more difficult since the output | ||
+ | # takes very long lines and separates them into 80 column blocks | ||
+ | # the indicator for this continuation is an equals sign (=) | ||
+ | # at the end of the line. Thus, we continue to read lines from | ||
+ | # STDIN so long as the current line ends with an equal sign | ||
+ | # and we concatinate all of the lines together | ||
+ | sub getLine { | ||
+ | my @lines; | ||
+ | while ( my $thisLine = <> ) { | ||
+ | chomp $thisLine; | ||
+ | if ( substr( $thisLine, -1 ) eq ' | ||
+ | #die " | ||
+ | chop $thisLine; # remove the equals sign | ||
+ | push @lines, $thisLine; | ||
+ | } else { | ||
+ | push @lines, $thisLine; | ||
+ | # | ||
+ | | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | |||
+ | # makes a category name from the div name | ||
+ | sub makeCategory { | ||
+ | my $initValue = shift; | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | } | ||
+ | |||
+ | |||
+ | my %found; | ||
+ | my $line; | ||
+ | my $count = 100; | ||
+ | my $category = ''; | ||
+ | while ( $line = & | ||
+ | # | ||
+ | #die unless $count--; | ||
+ | $line =~ s/=3D/=/gi; | ||
+ | # Ok, if we have a category already, and have found a </ | ||
+ | | ||
+ | # check for a line like <div id=" | ||
+ | # $matches[0] has the key name (ie, something), and $matches[1] has any subsequent | ||
+ | # information, | ||
+ | if ( my @matches = ($line =~ m/ | ||
+ | # print "Found div $matches[0]\n"; | ||
+ | # skip if $ignoreRegex defined has matches. Note, this is case insensitive | ||
+ | # die " | ||
+ | next if $ignoreRegex && $matches[0] =~ m/ | ||
+ | # if %lookFor empty, or not empty and has matching key, inlcude it | ||
+ | if ( ! %lookFor || $lookFor{$matches[0]} ) { | ||
+ | # Create the category | ||
+ | | ||
+ | # include any information beginning the div | ||
+ | | ||
+ | } | ||
+ | } elsif ( $category ) { | ||
+ | # we're in the middle of a div, so just add the line. | ||
+ | $found{$category} .= $line; | ||
+ | } | ||
+ | } | ||
+ | |||
+ | foreach my $key ( sort keys %found ) { | ||
+ | print " | ||
+ | } | ||
+ | |||
+ | 1; | ||
+ | |||
+ | </ |
unix/chromeos/systemreport.1688502598.txt.gz · Last modified: 2023/07/04 15:29 by rodolico