0
의 값을 변경 SED를 사용 :XML 파일 -이 xml 파일이 속성
<?xml version="1.0" encoding="UTF-8"?>
<testsuites>
<testsuite errors="0" failures="0" hostname="emulator-5554_tel_unknown_sdk" name="com.example.android.apis.tests.robotium" tests="3" time="4.4730" timestamp="Thu Jan 16 14:34:09 CET 2014">
<properties>
<property name="PROCESSOR_ARCHITECTURE" value="AMD64" />
<property name="file.encoding.pkg" value="sun.io" />
</properties>
<testcase classname="android.test.AndroidTestCase" name="testAndroidTestCaseSetupProperly" time="0.1750" />
</testsuite>
</testsuites>
나는 SED 명령으로 초보자입니다. testsuite 요소의 name 속성을 수정하고 싶습니다. 그 값에 호스트 이름 속성의 값을 접두어로 붙이고 싶습니다.
sed로 이런 종류의 생각을 할 수 있습니까? 코드 스 니펫이 있습니까?
고마워요. a.awk
이 어디
gawk -f a.awk RS="^$" file.xml
:은 GNU awk는 버전 4를 사용
엠마누엘
그것은 나쁜 'xml'을 파싱하는 아이디어 'sed'. 너는 그걸로 붙어 있니? – Birei
나쁜 아이디어 인 경우, 가장 좋은 아이디어는 무엇입니까? – Gillespie59
'xslt' 또는'java','python','perl','ruby'와 수백 개의 좋은 파서를 가진 언어가 있습니다. – Birei