|
Answer» Hi there,
I am using a utility to execute some processes and it creates a log file for me. Within that log file contains success or error codes. I WOULD like to be able to extract a certain string from that log file into another file.
IE: Original Log File: "Error Code 1 - \\computername" I would like to copy everthing within the original log file that contains "Error Code 1" into a new file.
I have done this a few months ago, but I have lost my original batch files that contained the script and I can't remember what I did! I'm THINKING I used the "TYPE" command, but I forget the syntax for GRABBING the string.
Thanks, Patrick You want to copy a log file if it contains the line "Error Code 1"?
Code: [Select] findstr /m "Error Code 1" C:\path to file\file.txt if %errorlevel%==0 ( XCOPY file.txt copy_of_file.txt )
FBIt was the FINDSTR command that I couldn't think of! I just added the following to my batch file:
findstr "Error Code 1*" "C:\DM_Customization.log" >> "C:\DM_ErrorCodes.log"
Thanks for you help. Patricknot a problem
FB
|