2013-07-10 4 views
0

내가배치 파일은

//output:One line,file info always 
-hF1 
+ffn 
-"format=%(%f %l%): Error -> %t %n %m" 

//Do not break lines 
-width(0,0) 

같은 파일이 전체 라인을 교체 다른 라인으로.

예 : 나는 텍스트 파일에서 단어 '형식'에 대한 검색 및 전체 라인 있음을 교체 한 다음

//output:One line,file info always 
    -hF1 
    +ffn 
    //See below line is changed 
    -"format=<message><file>%f</file> <line>%l</line> <type>%t</type> <code>%n</code> <desc>%m</desc></message>"<desc>%m</desc></message>" 

    //Do not break lines 
    -width(0,0) 

처럼 위의 파일의 출력이되어야한다.

답변

0

다음 배치 파일 사용 : repl.bat - http://www.dostips.com/forum/viewtopic.php?f=3&t=3855 이 명령은 여기서 작동합니다. input.txt와 output.txt는 파일이고 \ x22는 따옴표입니다. BTW 귀하의 교체 명령에 불균형 따옴표가 있습니다. 검색 할 문자열은 행의 어느 곳에서나 format=입니다.

type input.txt|repl "^.*format=.*" "-\x22format=<message><file>%f</file> <line>%l</line> <type>%t</type> <code>%n</code> <desc>%m</desc></message>\x22<desc>%m</desc></message>\x22" mx >output.txt 
관련 문제