1 2 3 4 5
#!/bin/sh ./xmlstarlet ed \ -s /xml/table/rec -t elem -n new-field -v new-value \ -i '$prev' -t attr -n new-attr -v new-attr-value \ xml/table.xml