I have a udcli output that looks like these (Just assume that the commands perfectly makes sense, there were just made by random byte generator actually)
我有一个看起来像这样的udcli输出(假设命令完全有意义,实际上只是由随机字节生成器制作)
00000000000005b9 dc4753 fadd qword [edi+0x53]
00000000000005bc 226d9e and ch, [ebp-0x62]
00000000000005bf 81a4a495dc47ff4b and dword [esp-0xb8236b], 0xe0076b4b
-6b07e0
00000000000005ca e667 out 0x67, al
00000000000005cc 9acc27d432520f call dword 0xf52:0x32d427cc
Notice the 3rd-4th line on which there is an extra line that extends form the 3rd line.
注意第3到第4行,其中有一条额外的线从第3行延伸。
Now, what I'm trying to do is to get the difference on the address of the next line to the previous line. I'm doing this by using my own awk script.
现在,我要做的是获得前一行下一行地址的差异。我是通过使用我自己的awk脚本来做到这一点的。
My problem is, when awk read the 3rd and 4th line, it gives me an output like these
我的问题是,当awk读取第3行和第4行时,它会给我一个这样的输出
3 dc4753 fadd qword [edi+0x53]
3 226d9e and ch, [ebp-0x62]
3 81a4a495dc47ff4b and dword [esp-0xb8236b],
-1471
1482 e667 out 0x67, al
2 9acc27d432520f call dword 0xf52:0x32d427cc
where the 1st column is size of the instruction (difference of 2 addresses)
其中第1列是指令的大小(2个地址的差异)
Now my question is, how can I make awk ignore that particular line so it outputs properly. Is this possible with grep instead?
现在我的问题是,如何让awk忽略该特定行,以便正确输出。这可能与grep相反吗?
My current awk script
我目前的awk脚本
udcli file.out | awk 'BEGIN{getline; print "0\t" $2 "\t" $3 "\t" $4 "\t" $5; a = 0; b = strtonum("0x"$1);} {a = strtonum("0x"$1); print a - b "\t" $2 "\t" $3 "\t" $4 "\t" $5; b = a;}'
2 个解决方案
#1
1
Hard to say for sure w/o seeing your actual awk-script, but something like this should help you on your way ...
很难说没有看到你的实际awk脚本,但这样的事情应该会帮助你...
awk '$1~/^000/' ...
#2
0
awk '/^\s/ { getline }
... rest of script' < inputfile
#1
1
Hard to say for sure w/o seeing your actual awk-script, but something like this should help you on your way ...
很难说没有看到你的实际awk脚本,但这样的事情应该会帮助你...
awk '$1~/^000/' ...
#2
0
awk '/^\s/ { getline }
... rest of script' < inputfile