findstr - 如何查找用户并显示整行?
我有一个包含多行数据的文件,例如:
dfscmd /map "\SERVER\PATH\AREA\testuser" "\NEW_SERVER\PATH\testuser" "DFSLink Home Drive: Test, User"
dfscmd /map "\SERVER\ PATH\AREA\testuser1" "\NEW_SERVER\PATH\testuser1" ""
我正在使用 FINDSTR 查找用户名(例如 testuser)和整个查询行 - 因此,如果 FINDSTR 找到标题为 testuser 的行,那么它应该显示该用户的整行:
查找:testuser 应该显示: \NEW_SERVER\PATH\testuser1
知道我该怎么做吗?我可以找到用户名,但不知道如何输出整行?
谢谢,
I have a file that contains multiple lines of data, e.g:
dfscmd /map "\SERVER\PATH\AREA\testuser" "\NEW_SERVER\PATH\testuser" "DFSLink Home Drive: Test, User"
dfscmd /map "\SERVER\PATH\AREA\testuser1" "\NEW_SERVER\PATH\testuser1" ""
I am using FINDSTR to find the username (e.g testuser) and the entire line of the query - so, if FINDSTR fins the line entitled testuser then it should display the entire line of that user:
Finds: testuser
Should display: \NEW_SERVER\PATH\testuser1
any idea how I can do this? I can get just to find the user name but no idea how to output the entire line?
Thanks,
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
尝试
findstr /C:searchstring fileyouaresearching.txt
Try
findstr /C:searchstring fileyouaresearching.txt