Tag Info

New answers tagged


xml-cut from xml-coreutils may accomplish your needs


I think the follow should help. This is usual task which should to do between two limits. unset f t while read l do t=${t:+$t\\n}$l l=${l//[<>]/} : ${f:="$l"} if [ "$l" = "/$f" ] then echo -e "$t" > "$f".xml unset f t fi done < <(cat your_xml_file)


The application XMLStarlet appears to be available on OSX via brew, so you should be able to install it like so: $ brew install xmlstarlet Once it's installed, you use it via the command line via the command xmlstarlet. Usage $ xmlstarlet XMLStarlet Toolkit: Command line utilities for XML Usage: xmlstarlet [<options>] <command> ...


With xmllint using libxml version 20708: Name of root node "something": xmllint --xpath "name()" file.xml Text "lol": xmllint --xpath "//*/*/text()" file.xml Script sql.sh: #!/bin/bash file="$1" table=$(xmllint --xpath "name()" "$file") value=$(xmllint --xpath "//*/*/text()" "$file") cat << EOF INSERT INTO \`${table}\` VALUES (${value}) EOF ...


It looks like your output is in some way encoded. You can try to pipe the output from grep through sed, it that is the only sequence you have to change: echo 'AAA"& #x5c;"BBB"& #x5c;"CCC' | sed 's/"& #x5c;"/\//g' will give you AAA/BBB/CCC

Top 50 recent answers are included