Created
November 20, 2018 14:06
-
-
Save RockyRoad29/04ac18146401f030578577d6fcf31af9 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
BEGIN { | |
FS = "\n" # 4.5.5 Making the Full Line Be a Single Field | |
# line_re = "^(In|Out)[[]([0-9]+)[]]: (.*)" | |
# line_re = /(In |Out).([0-9]+).: (.*)/ | |
line_re = "^(In |Out)[[]([0-9]*)[]]: (.*)$" | |
} | |
# /^In/ { | |
# st = substr($0,index($0,':') + 1); | |
# out = getline(); | |
# if (out) { | |
# rslt = substr($out, index($out,':') + 1); | |
# print st, " # =>", rslt | |
# } | |
# } | |
function trace(pfx, var) { | |
if (0) { | |
print pfx, var | |
} | |
} | |
NR < 5 {next} | |
/^#?\s*$/ {print} | |
#/^#/ {next} | |
match($0, line_re, fields) { | |
trace(" -", fields[1]) | |
trace(" -", fields[2]) | |
trace(" -", fields[3]) | |
if (fields[1]=="In " ) { | |
trace("IN:", $0) | |
st = fields[3] | |
if (getline && match($0, line_re, fields) && (fields[1]=="Out")) { | |
rslt = fields[3] | |
print st, "# =>", rslt | |
} else { | |
print st | |
} | |
next; | |
} else { | |
} | |
} | |
{ | |
trace("UNMATCHED:", $0) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment