解析 .txt 文件
我有一个 .txt 文件,例如:
Symbols from __ctype_tab.o:
Name Value Class Type Size Line Section
__ctype |00000000| D | OBJECT |00000004| |.data
__ctype_tab |00000000| r | OBJECT |00000101| |.rodata
Symbols from _ashldi3.o:
Name Value Class Type Size Line Section
__ashldi3 |00000000| T | FUNC |00000050| |.text
如何解析此文件并获取 FUNC 类型的函数? 另外,我如何从这个txt中解析和提取.o名称?
我如何通过按列解析来获取它们或者如何获取它们。
我需要立即帮助...像往常一样等待适当的解决方案
I have a .txt file like:
Symbols from __ctype_tab.o:
Name Value Class Type Size Line Section
__ctype |00000000| D | OBJECT |00000004| |.data
__ctype_tab |00000000| r | OBJECT |00000101| |.rodata
Symbols from _ashldi3.o:
Name Value Class Type Size Line Section
__ashldi3 |00000000| T | FUNC |00000050| |.text
How can i parsr this file and get the functions with type FUNC ?
Also,from this txt how can i parse and extract .o name ?
How can i get them by column wise parsing or else how.
I need an immediate help...Waiting for an appropriate solution as usual
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我认为这可能比使用正则表达式花费更少,尽管我不完全清楚你想要完成什么,
我从其他帖子中了解到,当你阅读文件时,包装所有数据更便宜、更好第一次。 因此,如果您想一次性打包整个数据文件,那么您可以执行以下操作然后,
如果您想要 Func 类型,您可以使用以下内容:
抱歉,我这么着迷,但我正在尝试更好地处理创建列表理解,我决定这值得一试
I think this might cost less than the use of regexes though i am not totally clear on what you are trying to accomplish
I have learned from other posts it is cheaper and better to wrap up all of the data when you are reading through a file the first time. Thus if you wanted to wrap up the whole datafile in one pass then you could do the following instead
Then if you want the Func type you would use the following:
Sorry for being so obsessive but I am trying to get a better handle on creating list comprehensions and I decided that this was worthy of a shot
这是一个基本方法。 你怎么认为?
Here is a basic approach. What do you think?