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 "_":

See:

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

So the new solution is:

Code:
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?
DevAakash
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
5
UNIX for Beginners Questions & Answers
Replace string in XML file with awk/sed with string from another
cozzin
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
9
Shell Programming and Scripting
Grep a string from input file and delete next three lines including the line contains string in xml
greet_sed
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
4
Shell Programming and Scripting
get rid of xml comment by grep or sed
RonLii
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
3
Shell Programming and Scripting
replace string in XML with sed
chiru_h
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
6
Shell Programming and Scripting
BZGREP(1)						      General Commands Manual							 BZGREP(1)

NAME
bzgrep, bzfgrep, bzegrep - search possibly bzip2 compressed files for a regular expression
SYNOPSIS
bzgrep [ grep_options ] [ -e ] pattern filename... bzegrep [ egrep_options ] [ -e ] pattern filename... bzfgrep [ fgrep_options ] [ -e ] pattern filename...
DESCRIPTION
Bzgrep is used to invoke the grep on bzip2-compressed files. All options specified are passed directly to grep. If no file is specified, then the standard input is decompressed if necessary and fed to grep. Otherwise the given files are uncompressed if necessary and fed to grep. If bzgrep is invoked as bzegrep or bzfgrep then egrep or fgrep is used instead of grep. If the GREP environment variable is set, bzgrep uses it as the grep program to be invoked. For example: for sh: GREP=fgrep bzgrep string files for csh: (setenv GREP fgrep; bzgrep string files)
AUTHOR
Charles Levert (charles@comm.polymtl.ca). Adapted to bzip2 by Philippe Troin <phil@fifi.org> for Debian GNU/Linux.
SEE ALSO
grep(1), egrep(1), fgrep(1), bzdiff(1), bzmore(1), bzless(1), bzip2(1) BZGREP(1)

Featured Tech Videos