Sponsored Content
Full Discussion: Parsing XML
Top Forums Shell Programming and Scripting Parsing XML Post 302556548 by clx on Monday 19th of September 2011 04:54:17 AM
Old 09-19-2011
RS means record separator (each line).
Setting it to "<" was actually means the input line is being splitted after each "<" character. So that you will get values like ..

Code:
Subroamer>Power
/Subroamer>\n
Subsubroamer>Port A BC6 CH 25 Mid1 Power
ServSid>CDMA BC6 Power Port A BC6 CH 25 Mid1Power

As you know, We are interested in the later part ( after the ">" character), so FS (field separator ">" is used and in this way fetching second field ($2).

$0=$2, is replacing everything in the line with $2 so that processing could be simpler.
You could skip that part. but you need to do something like this '..... {sub(/\\/,"",$2);print $2}'.
 

10 More Discussions You Might Find Interesting

1. Programming

XML parsing

Hi I want to take an XML file and transform it into a pipe-delimited format. What is the best tool to use for this? I have libxml2 which seems to be the best xml parser around. The xml file will have the following format. <Txn> <Date>120504</Date> <id>99</id> <Items> <Item>... (1 Reply)
Discussion started by: handak9
1 Replies

2. Shell Programming and Scripting

parsing xml

I want to use wget comment to parse an xml parse that exist in an online website. How can I connect it using shell script through Unix and how can I parse it?? (1 Reply)
Discussion started by: walnut
1 Replies

3. Shell Programming and Scripting

XML Parsing

Hi, Need a script to parse the following xml file content <tag1 Name="val1"> <abc Name="key"/> <abc Name="pass">*********</abc> </tag1> <tag2 Name="Core"> <Host Name="a.b.c"> <tag1 Name="abc"> <abc Name="ac">None</abc> ... (4 Replies)
Discussion started by: Mavericc
4 Replies

4. Shell Programming and Scripting

XML parsing

I have a xml file attached. I need to parse parameterId and its value My output should be like 151515 38 151522 32769 and so on.. Please help me. Its urgent (6 Replies)
Discussion started by: LavanyaP
6 Replies

5. UNIX for Advanced & Expert Users

XML Parsing

I had a big XML and from which I have to make a layout as below *TOTAL+CB | *CB+FX | CS |*IR | *TOTAL | -------------------------------------------------------------------------------------------------- |CB FX | | | | DMFXNY EMSGFX... (6 Replies)
Discussion started by: manas_ranjan
6 Replies

6. Shell Programming and Scripting

Parsing XML

I am trying to parse an xml file and trying to grab certain values and inserting them into database table. I have the following xml that I am parsing: <dd:service name="locator" link="false"> <dd:activation mode="manual" /> <dd:run mode="direct_persistent" proxified="false" managed="true"... (7 Replies)
Discussion started by: $criptKid617
7 Replies

7. Shell Programming and Scripting

XML: parsing of the Google contacts XML file

I am trying to parse the XML Google contact file using tools like xmllint and I even dived into the XSL Style Sheets using xsltproc but I get nowhere. I can not supply any sample file as it contains private data but you can download your own contacts using this script: #!/bin/sh # imports... (9 Replies)
Discussion started by: ripat
9 Replies

8. Shell Programming and Scripting

XML parsing

i have xml output in below format... <AlertsResponse> <Alert id="11216" name="fgdfg"> <AlertActionLog timestamp="1356521629778" user="admin" detail="Recovery Alert"/> </Alert> <Alert id="11215" name="gdfg <AlertActionLog timestamp="1356430119840" user=""... (12 Replies)
Discussion started by: vivek d r
12 Replies

9. Shell Programming and Scripting

XML Parsing :

HI I want to parse below file in to two output :- Input :- ?xml version="1.0" encoding="UTF-8"?> <bulkCmConfigDataFile xmlns:un="utranNrm.xsd" <configData dnPrefix="Undefined"> <xn:SubNetwork id="ONRM_ROOT_MO_R"> <xn:MeContext id="C136"> ... (3 Replies)
Discussion started by: asavaliya
3 Replies

10. Shell Programming and Scripting

XML parsing

I have an xml file where the format looks like below <SESSIONCOMPONENT REFOBJECTNAME ="pre_session_command" REUSABLE ="NO" TYPE ="Pre-session command"> <TASK DESCRIPTION ="" NAME ="pre_session_command" REUSABLE ="NO" TYPE ="Command" VERSIONNUMBER ="1"> ... (8 Replies)
Discussion started by: r_t_1601
8 Replies
XML::Feed::Entry(3pm)					User Contributed Perl Documentation				     XML::Feed::Entry(3pm)

NAME
XML::Feed::Entry - Entry/item in a syndication feed SYNOPSIS
## $feed is an XML::Feed object. for my $entry ($feed->entries) { print $entry->title, " ", $entry->summary, " "; } DESCRIPTION
XML::Feed::Entry represents an entry/item in an XML::Feed syndication feed. USAGE
XML::Feed::Entry->new($format) Creates a new XML::Feed::Entry object in the format $format, which should be either RSS or Atom. $entry->convert($format) Converts the XML::Feed::Entry object into the $format format, and returns the new object. $entry->title([ $title ]) The title of the entry. $entry->base([ $base ]) The url base of the entry. $entry->link([ $uri ]) The permalink of the entry, in most cases, except in cases where it points instead to an offsite URI referenced in the entry. $entry->content([ $content ]) An XML::Feed::Content object representing the full entry body, or as much as is available in the feed. In RSS feeds, this method will look first for <http://purl.org/rss/1.0/modules/content/#encoded> and <http://www.w3.org/1999/xhtml#body> elements, then fall back to a <description> element. $entry->summary([ $summary ]) An XML::Feed::Content object representing a short summary of the entry. Possibly. Since RSS feeds do not have the idea of a summary separate from the entry body, this may not always be what you want. If the entry contains both a <description> element and another element typically used for the full content of the entry--either http://www.w3.org/1999/xhtml/body or <http://purl.org/rss/1.0/modules/content/#encoded>--we treat that as the summary. Otherwise, we assume that there isn't a summary, and return an XML::Feed::Content object with an empty string in the body. $entry->category([ $category ]) The category in which the entry was posted. Returns a list of categories if called in array context or the first category if called in scalar context. WARNING It's possible this API might change to have an add_category instead. $entry->tags([ $tag ]) A synonym (alias) for category; $entry->author([ $author ]) The name or email address of the person who posted the entry. $entry->id([ $id ]) The unique ID of the entry. $entry->issued([ $issued ]) A DateTime object representing the date and time at which the entry was posted. If present, $issued should be a DateTime object. $entry->modified([ $modified ]) A DateTime object representing the last-modified date of the entry. If present, $modified should be a DateTime object. $entry->wrap Take an entry in its native format and turn it into an XML::Feed::Entry object. $entry->unwrap Take an XML::Feed::Entry object and turn it into its native format. AUTHOR &; COPYRIGHT Please see the XML::Feed manpage for author, copyright, and license information. perl v5.14.2 2012-03-21 XML::Feed::Entry(3pm)
All times are GMT -4. The time now is 12:00 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy