make sample.xml of this format, this is one entry
name
usn
dept
name
id
total
1) sed "/dept/,/\dept/d" sample.xml >student.xml
2) sed "/dept/,/\dept/s/name/deptname/g" sample.xml >dept.xml
3) sed -n '/usn/{s/.*//;s/<\/usn.*//;p;}' sample.xml > usn.txt