Search code examples
windowsdosfindstr

findstr - how to find user and display entire line?


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,


Solution

  • Try findstr /C:searchstring fileyouaresearching.txt