두 html 사이의 차이점을 얻으려고합니다. 그러나 문자열에 my-attribute이라는 속성이 있으면 diff를 계산할 때 my-attribute 및 해당 값을 무시하고 싶습니다.sed가 작동하지 않는 차이점
diff 유틸리티를 사용하여 파일간에 차이점을 얻고 있습니다.
아래 정규식은 diff 외부에서 작동합니다. 내가 같은 sed를 사용하는 경우
<html>
<body>
<div>
<span my-attribute="8885" >html1</span>
</div>
</body>
</html>
그러나 DIFF 내부
는, 그것은 나에게 이것은 오류를 제공bash -c 'diff -y <(sed -E '[email protected](my-attribute)="[^"]*" @@g' html1.html) <(sed -E '[email protected](my-attribute)="[^"]*" @@g' html2.html)'
구문 오류를주고 다음과 같이
sed -E '[email protected](my-attribute)="[^"]*" @@g' html1.html
html1.html입니다 : 예기치 않은 토큰 근처에서 구문 오류가 발생했습니다. '('
올바른 명령을 얻으려면 도움이 필요하십니까?
편집 : 추가 html2.html
<html>
<body>
<div>
<span my-attribute="123" >html2</span>
</div>
</body>
</html>
@Inian 유무는 = html2.html – ConfusionPrevails