Tag Info

New answers tagged


Try this: grep "<TD>" yourfile.xml | awk -F "TD" '{gsub(">|</","",$0); print $2;}' the output will be: 51.9029244701 47.0082067303 grep select xml TD tag, awk use TD as separator and remove > and </ from $2 field.


I wrote up a very simple Python script that will read in an xml file, and output its contents into another file: import sys inFile = open(sys.argv[1], 'r') outFile = open(sys.argv[2], 'w') read = True for i in inFile.read(): if i == '<': read = not read if read: outFile.write(i) if i == '>': read = not read ...


You shouldn't use something like sed/awk for it and use an xml/xslt processor, such as xmlstarlet instead. Create an xslt file with a template such as and save it under transform.xsl: <?xml version="1.0"?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> <xsl:template match="@*|node()"> ...


Do it as you prefer but here it is: STR='<tag name="abc"></tag>' AUX=$(echo $STR | cut -d"\"" -f2) echo $STR | sed "s/tag/$AUX/g"

Top 50 recent answers are included