문제

I have this .xml file:

<docs>
<doc>
Some text
</doc>
<doc>
here some
</doc>
<doc>
text here
</doc>
</docs>

I am trying to use csplit in order to get only the text parts. This is what I came up with.

$ csplit docs.xml '%^<docs>%1' '/^<\/doc/1' '{*}'
도움이 되었습니까?

해결책

if the file structure like the one you included you can extract the content by doing grep -v "^<" x or more conveniant approach cat x|sed -e 's/<[^>]*>//g'|grep -v '^$' or to do it the csplit way based on the comments below you can do it lik this

cat doc.xml | egrep -v '<?xml version="1.0" \?>|<docs>|</docs>' | csplit -q -z - '/<doc/' '{*}' --prefix=out-
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top