Today (Saturday) We will make some minor tuning adjustments to MySQL.

You may experience 2 up to 10 seconds "glitch time" when we restart MySQL. We expect to make these adjustments around 1AM Eastern Daylight Saving Time (EDT) US.

Getting string from xml tags using sed and grep

Login or Register to Reply

Thread Tools Search this Thread
# 8  
xmlstarlet 1.5.0 onwards allow an easier command using the default namespace of a document which is named "_":


Chapter*5.*Common problems
Chapter 5 / Paragraph 1.3

So the new solution is:

xmlstarlet sel -t -v "//_:project/_:version" -n data.xml

Login or Register to Reply

Thread Tools Search this Thread
Search this Thread:
Advanced Search

More UNIX and Linux Forum Topics You Might Find Helpful
How to fetch the value from a xml using sed, GREP?
I have a simple xml file,need the output with the <value> tag and <result> tag text.xml <test-method status="FAIL" duration="45"> <value> Id=C18 </value> <result> wrong paramter </result> </test-method> <test-method status="FAIL" duration="45"> <value> Id=C19 </value> <result> Data...... UNIX for Beginners Questions & Answers
UNIX for Beginners Questions & Answers
Replace string in XML file with awk/sed with string from another
Sorry for the long/weird title but I'm stuck on a problem I have. I have this XML file: </member> <member> <name>TransactionID</name> <value><string>123456789123456</string></value> </member> <member> <name>Number</name> ...... Shell Programming and Scripting
Shell Programming and Scripting
Grep a string from input file and delete next three lines including the line contains string in xml
Hi, 1_strings file contains $ cat 1_strings /home/$USER/Src /home/Valid /home/Review$ cat myxml <projected value="some string" path="/home/$USER/Src"> <input 1/> <estimate value/> <somestring/> </projected> <few more lines > <projected value="some string" path="/home/$USER/check">...... Shell Programming and Scripting
Shell Programming and Scripting
get rid of xml comment by grep or sed
Hi, I would like to get rid of all comment in an xml file by grep or sed command: The content seem like this: <!-- ab cd ef gh ij kl --> Anyone can help? Thanks and Regards... Shell Programming and Scripting
Shell Programming and Scripting
replace string in XML with sed
Greetings, I have an XML : file.xml <component> <name>abcd</name> <value>1234</value> </component> I am using sed to replace abcd with the desired value dynamically without knowing the actual value. sed 's/<name>./]\{1,\}<\/name>/<name>ijkl<\/name>/' file.xml > newfile.xml I...... Shell Programming and Scripting
Shell Programming and Scripting
GREP(1) 						      General Commands Manual							   GREP(1)

grep - search a file for a pattern
grep [ option ... ] pattern [ file ... ]
Grep searches the input files (standard input default) for lines (with newlines excluded) that match the pattern, a regular expression as defined in regexp(6). Normally, each line matching the pattern is `selected', and each selected line is copied to the standard output. The options are -c Print only a count of matching lines. -h Do not print file name tags (headers) with output lines. -i Ignore alphabetic case distinctions. The implementation folds into lower case all letters in the pattern and input before interpre- tation. Matched lines are printed in their original form. -l (ell) Print the names of files with selected lines; don't print the lines. -L Print the names of files with no selected lines; the converse of -l. -n Mark each printed line with its line number counted in its file. -s Produce no output, but return status. -v Reverse: print lines that do not match the pattern. Output lines are tagged by file name when there is more than one input file. (To force this tagging, include /dev/null as a file name argument.) Care should be taken when using the shell metacharacters $*[^|()= and newline in pattern; it is safest to enclose the entire expression in single quotes '...'.
ed(1), awk(1), sed(1), sam(1), regexp(6)
Exit status is null if any lines are selected, or non-null when no lines are selected or an error occurs. GREP(1)

Featured Tech Videos