나는 로그 파일을 아래와 같이있다 :특정 단어 다음에 단락 끝까지 로그 파일의 모든 줄을 인쇄하는 방법은 무엇입니까?
Beginning difffull backup for database Managed_Metadata_Service, 3 of 149.
Full: 0 Read: 6144 Written: 0 Rate: 0.00 Kb/Sec
Full: 4 Read: 6144 Written: 0 Rate: 0.00 Kb/Sec
Backup of Managed_Metadata_Service failed.
ANS0238E (RC2041) The sequence of calls is invalid.
Beginning difffull backup for database model, 4 of 149.
Full: 0 Read: 6144 Written: 0 Rate: 0.00 Kb/Sec
Full: 2 Read: 6144 Written: 0 Rate: 0.00 Kb/Sec
Full: 4 Read: 6144 Written: 0 Rate: 0.00 Kb/Sec
Backup of model failed.
ANS0238E (RC2041) The sequence of calls is invalid.
Beginning difffull backup for database msdb, 5 of 149.
Full: 0 Read: 6144 Written: 0 Rate: 0.00 Kb/Sec
Full: 4 Read: 6144 Written: 0 Rate: 0.00 Kb/Sec
Backup of msdb failed.
ANS0238E (RC2041) The sequence of calls is invalid.
Beginning difffull backup for database Search_Service_Application_AnalyticsReportingStoreDB, 6 of 149.
Full: 0 Read: 6144 Written: 0 Rate: 0.00 Kb/Sec
Full: 4 Read: 6144 Written: 0 Rate: 0.00 Kb/Sec
Backup of Search_Service_Application_AnalyticsReportingStoreDB failed.
ANS0238E (RC2041) The sequence of calls is invalid.
어떻게 failed
의 모든 항목을 찾은 다음 단락의 끝에서 다음 점까지 뜻이 단어와 메시지 끝날 때까지 다음 라인으로 라인을 인쇄 할 수 있습니다 또는 파일의 끝?
결과는 다음과 같다 : failed
단어로 모든 라인에 대한
Backup of Managed_Metadata_Service failed.
ANS0238E (RC2041) The sequence of calls is invalid.
.
.
Search_Service_Application_AnalyticsReportingStoreDB failed.
ANS0238E (RC2041) The sequence of calls is invalid.
.
@echo off
setlocal EnableDelayedExpansion
set numbers=
for /F "delims=^" %%a in ('findstr /I /N /C:"failed" Backup_DIFF_2017-12-14.log') do (
set /A sameline=%%a, after=%%a+1
set "numbers=!numbers!!sameline!: !after!: "
)
rem Search for the lines
(
for /F "tokens=* delims=^ %%a in ('findstr /N "^" Backup_DIFF_2017-12-14.log ^| findstr /B "%numbers%"') do echo %%b
) > result.txt
'find'failed file.log'? – Stephan
나는 그것을 찾기 위해 배치 파일을 만들어 단어 (실패)와 다음 줄에 오류 메시지 –
@CienzoJoshua가 포함 된 줄을 인쇄하고, 파일 내용을 선택/강조 표시 한 다음 **'{}'을 누르십시오 ** 단추. – Compo