#!/usr/bin/env bash # System State Dump "explorer" # It just adds links to parent State Object location in the file for easier navigation # Copyright 2018 Tanel Poder. All rights reserved. More info at http://tanelpoder.com # Licensed under the Apache License, Version 2.0. See LICENSE.txt for terms & conditions. TRACEFILE=$1 OUTPUTFILE=$1.html sed -e ' s//\>/g s/SO: \(0x[A-Fa-f0-9]*\)/SO: \1<\/mark><\/a>/ s/LIBRARY HANDLE:\(0x[A-Fa-f0-9]*\)/LIBRARY HANDLE:\1<\/a>/ s/owner: \(0x[A-Fa-f0-9]*\)/owner: \1<\/a>/ s/handle=\(0x[A-Fa-f0-9]*\)/handle=\1<\/a>/ ' $TRACEFILE | awk ' BEGIN { print "System State Dump Explorer by Tanel Poder
" }
   { print $0 }
   END { print "
" } ' > $OUTPUTFILE echo Done writing into $OUTPUTFILE echo ls -l $OUTPUTFILE #awk ' # # BEGIN { print "System State Dump Explorer by Tanel Poder
" }
#    
#    /0x[A-Fa-f0-9]/ { gsub( /(0x[A-Fa-f0-9]*)/, "&", $0 ) }
#     
##    /SO: 0x[A-Za-z0-9]/ {
##        match($0, /(0x[A-Fa-f0-9]*),/ , arr)
##        printf ("%s\n", arr[1], gsub( /(0x[A-Fa-f0-9]*)/, "&", $0 ) )
##        
##    }
##    !/SO: 0x[A-Fa-f0-9]/ { gsub(/(0x[A-Fa-f0-9]*)/, "&", $0) ; printf("%s\n", $0)  }
#    
#    
#    END { print "
" } # # #' | awk '/SO: / { sub( /