I am very new to the UNIX shell scripting and would like to learn. However, I am currently stuck on how to process the below sample of code from an XML file using UNIX comands:
Goal: Write a script to look for a certain attribute by name (i.e. "Memory") and return its value (i.e. "512MB" in this example).
Being new to shell scripting and UNIX in general, I had a very tough time trying to sort out whether to use awk, sed, grep, and the various other UNIX commands. My line of logic is to first grep the attribute name ("Memory") and I got that far, but I'm not sure how to cut the VALUE from the string.
Another frustrating thing is that the UNIX box I need to run this script on is pretty "vanilla" in the sense that it does not appear to have any sort of XML parsing tools such as xmlt, etc. so I am stuck with using the default UNIX commands.
If someone can kindly advise me on how to approach this issue, that would be much appreciated!
Hi Jean
I require your help in writing a shell script. Iam zero in Unix programming. I have a large file about 400 MB of data, which contains about 50000 XML messages seperated by a Tab, I think. I need to extract only 4 values from each XML message and write it onto a new file. Please help me... (2 Replies)
Hi All,
I'm trying to extract the values for the 'src' and 'alt' tags within an xml file. In the files that I'm searching, the tags are always enclosed within an 'img' tag. Typically:
<img src="diwiz01.gif" width="576" height="254" alt="Out-of-process and In-process COM Objects"><bookmark... (3 Replies)
Hi All,
Please help me out in resolving this..
<secondTag enabled='true' processName='test1' pidFile='/tmp/test1.pid' />
From the above tag, I'm trying to retrieve the value of enabled and pidFile attributes by means of processName attribute.
Would be thankful in resolving this..... (5 Replies)
Hi All,
Find the following code:
<Universal>D38x82j1JJ
</Universal>
I want to retrieve the value of <Universal> tag as below:
Please help me. (3 Replies)
Hi Guys
Here is my Input :
<?xml version="1.0" encoding="UTF-8"?>
<xn:MeContext id="01736">
<xn:VsDataContainer id="01736">
<xn:attributes>
<xn:vsDataType>vsDataMeContext</xn:vsDataType>
... (12 Replies)
I want to basically do the below thing. Suppose there is a tag called object1. I want to display an output for all similar tag values under heading of Object 1 and the count of the xmls. Please help
File:
<xml><object1>house</object1><object2>child</object2>... (9 Replies)
Hi,
My requirement is something like this,
I have a xml file that contains some tags and nested tags,
<n:tag_name1>
<n:sub_tag1>val1</n:sub_tag1>
<n:sub_tag2>val2</n:sub_tag2>
</n:tag_name1>
<n:tag_name2>
<n:sub_tag1>value</n:sub_tag1>
... (6 Replies)
Hi Forum.
I have an XML file with the following requirement to move the <AdditionalAccountHolders> tag and its content right after the <accountHolderName> tag within the same file but I'm not sure how to accomplish this through a Unix script.
Any feedback will be greatly appreciated.
... (19 Replies)
Discussion started by: pchang
19 Replies
LEARN ABOUT DEBIAN
gfxattr
GFXATTR(1)GFXATTR(1)NAME
gfxattr - Manipulate extended attributes in Gfarm file system
SYNOPSIS
gfxattr [ -s | -g | -l | -r ] [ -x ] [ -c | -m ] [ -f xattrfile ] file [ xattrname ]
DESCRIPTION
gfxattr manipulates extended attributes and XML extended attributes of a specified file. An extended attribute consists of an attribute
name and an attribute value, which are arbitrary strings. An XML extended attribute is an extended attribute having an XML attribute
value. Since XML extended attributes have a different name space from extended attributes, the same attribute name can be used.
When the -x option is specified, XML extended attributes are manipulated. It is possible to search XML extended attributes by XPath query
using gffindxmlattr command.
All files and directories in Gfarm file system can keep extended attributes. When removing a file or directory, the associated extended
attributes are also removed.
Either -s, -g, -l, or -r option should be specified.
OPTIONS -s sets a new value with an extended attribute xattrname for a specified file. With the -f option, the value can be specified by the
file xattrfile instead of by the standard input. When neither -c nor -m option is specified, the extended attribute is overwritten
if it is already set.
-g reads a value with an extended attribute xattrname for a specified file.
-l display a list of extended attributes for a specified file.
-r removes a extended attribute xattrname for a specified file.
-x manipulates XML extended attributes.
-c sets a new extended attribute if it is not set. This option is used with the -s option.
-m modifies the extended attribute if there it is. This option is used with the -s option.
-f xattrfile
With the -s option, reads an extended attribute from the specified xattrfile instead of from the standard input. With the -g
option, writes the extended attribute to the specified xattrfile instead of to the standard output.
-? displays usage.
SEE ALSO gffindxmlattr(1)Gfarm 18 August 2009 GFXATTR(1)