Skip to content

Commit

Permalink
Update trace-cmd-status.sh
Browse files Browse the repository at this point in the history
Fixes #63 by altering string handling for awk regexp matches - wrap expressions in apostrophes and explicitly escape out spaces.

Tested against awk 5.3.0
  • Loading branch information
pallaswept authored and mikesart committed Aug 4, 2024
1 parent 9996428 commit a846ab7
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions sample/trace-cmd-status.sh
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,13 @@ done

awk 'BEGIN { time = 0; entries = 0; overrun = 0 }
{
if ( $0 ~ /^entries\:/ )
if ( $0 ~ '/^entries\:/' )
entries = $2
if ( $0 ~ /^overrun\:/ )
if ( $0 ~ '/^overrun\:/' )
overrun = $2
if ( $0 ~ /^oldest event ts\:/ )
if ( $0 ~ '/^oldest\ event\ ts\:/' )
time = (float)$4
if ( $0 ~ /^now ts\:/ ) {
if ( $0 ~ '/^now\ ts\:/' ) {
time = (float)$3 - time
if ( entries == 0 )
printf "%s entries:%u\n", FILENAME, entries
Expand Down

0 comments on commit a846ab7

Please sign in to comment.