开发者

findstr - how to find user and display entire line?

开发者 https://www.devze.com 2023-01-25 07:55 出处:网络
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\"

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 out开发者_高级运维put the entire line?

Thanks,


Try findstr /C:searchstring fileyouaresearching.txt

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号