使用列表中的输入搜索文件 [英] search a file using input from a list

查看:86
本文介绍了使用列表中的输入搜索文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,我想知道是否有人可以帮助解决这个问题


我有一个文件A:用户名列表

我有一个文件B:包含用户名的字段的事件列表


我想使用列表作为输入按用户名搜索事件列表。


我可以打开文件B并使用单个输入进行搜索,我可以打开并搜索这两个文件我只是无法解决如何使用A搜索B.我试着将两者加载到数组中。它开始让我夜不能寐。我会加载我的脚本,但我已经搞砸了这么多我不认为它现在意味着什么....

Hi all, i wonder if any one could help with this problem

I have a fileA: a list of usernames
I have a fileB: a list of events with a field containinng the username

I want to search the list of events by username using the list as input.

I can open the fileB and search using single input, I can open and search both files I just can''t work out how to search B using A. I''m tried loading both into arrays. It''s starting to keep me awake at night. I would load my script but I''ve messed about with it so much I don''t think it means anything now....

推荐答案

仍然在这里尝试是我的代码

still trying here is my code

展开 | 选择 | Wrap | 行号


搜索文件没有一致的格式?


xxxxxxxxxxxxxxxxxxxxxxxxCC284058vvvvvvvvvvvvvvvvvvvvvvvv

fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff fffffff

xxxxxxxxxxxxxxxCC283663mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm

1191934Alllllllllll lllllllllllllllllllllllllllllll lllllll

oooooooooooooooooooooooooooooooooooooooooooooooooo OOOOOOO

bbbbbbbbb1060503Ahhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh hhhhhhh形式

gggggggg1056024Hpppppppppppppppppppppppppppppppppp ppppppp

########## #############################################


用户名可以在文件中的任何位置吗?
The search file has no consistent formatting?

xxxxxxxxxxxxxxxxxxxxxxxxCC284058vvvvvvvvvvvvvvvvvv vvvvvvv
ffffffffffffffffffffffffffffffffffffffffffffffffff fffffff
xxxxxxxxxxxxxxxCC283663mmmmmmmmmmmmmmmmmmmmmmmmmmm mmmmmmm
1191934Allllllllllllllllllllllllllllllllllllllllll lllllll
oooooooooooooooooooooooooooooooooooooooooooooooooo ooooooo
bbbbbbbbb1060503Ahhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh hhhhhhh
gggggggg1056024Hpppppppppppppppppppppppppppppppppp ppppppp
################################################## #####

the "username" can be anywhere in the file?


您正在以覆盖模式打开outfile,因此每次写入它都会覆盖前一个条目。

尝试打开随着附加。即:
You are opening the outfile in overwrite mode, so each time it writes to it it overwrites the previous entry.
try opening it with the append. ie:
展开 | 选择 | Wrap | 行号


这篇关于使用列表中的输入搜索文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆