Sponsored Content
Top Forums Shell Programming and Scripting reformatting xml file, sed or awk I think (possibly perl) Post 302514569 by bartus11 on Saturday 16th of April 2011 06:43:56 PM
Old 04-16-2011
Try:
Code:
perl -pe 's/<(\w+) (\w+)>/<\1 \1="\2">/' file

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How to parse a XML file using PERL and XML::DOm

I need to know the way. I have got parsing down some nodes. But I was unable to get the child node perfectly. If you have code please send it. It will be very useful for me. (0 Replies)
Discussion started by: girigopal
0 Replies

2. Shell Programming and Scripting

sed or awk to extract data from Xml file

Hi, I want to get data from Xml file by using sed or awk command. I want to get the following result : mon titre 1;Createur1;Dossier1 mon titre 1;Createur1;Dossier1 and save it in cvs file (fichier.cvs). FROM this Xml file (test.xml): <playlist version="1"> <trackList> <track>... (1 Reply)
Discussion started by: yeclota
1 Replies

3. Shell Programming and Scripting

How to get value from xml node using sed/perl/script?

hello, new to this forum. but i have a requirement to extract the value from multiple xml node and print out the values to new file with comma seperated. would like to know how this would be done using either sed/perl or some unix script. an example would be tremendous... sample input file:... (2 Replies)
Discussion started by: davidsouk
2 Replies

4. Shell Programming and Scripting

Using SED/AWK to extract xml at end of file

Hello everyone, Firstly i do not require alot of help.. i am right at the end of finishing my scipt but cannot find a solution to the last part. What i need to do is, prompt the user for a file to work with, which i have done. promt the user for an output file - which is done. #!/bin/bash... (14 Replies)
Discussion started by: hugh86
14 Replies

5. Shell Programming and Scripting

awk multiple file reformatting

I hopefully have a simple request - I need to process multiple files reformatting the output based on tags at the beginning of each line. So the data for the new 3 lines of the output file are in the HDR line and then the details are in the DTL tagged lines. for ifile in $indir do echo... (1 Reply)
Discussion started by: jason_v_brown
1 Replies

6. Shell Programming and Scripting

Using sed (or awk or perl) to delete rows in a file

I have a Unix file with 200,000 records, and need to remove all records from the file that have the character ‘I' in position 68 (68 bytes from the left). I have searched for similar problems and it appears that it would be possible with sed, awk or perl but I do not know enough about any of these... (7 Replies)
Discussion started by: joddo
7 Replies

7. Shell Programming and Scripting

Modify the file with awk,sed or perl

Hi All, I need help from any of you.Would be so thankful for your help. I/P DDDD,1045,161,1557,429,1694,800,1911,1113,2460,1457,2917> 1609,3113,1869,3317,2732,3701,3727,4132,5857,5107> 9004,6496 DDDD,1125,157,1558,429,1694,800,1911,1117,2432,1444,2906>... (2 Replies)
Discussion started by: Indra2011
2 Replies

8. Shell Programming and Scripting

Get multiple values from an xml file using one of the following commands or together awk/perl/script

Hello, I have a requirement to extract the value from multiple xml node and print out the values to new file to compare. Would be done using either awk/perl or some unix script. For example sample input file: ..... ..... <factories xmi:type="resources.jdbc:DataSource"... (2 Replies)
Discussion started by: slbmind
2 Replies

9. Shell Programming and Scripting

Splitting xml file into several xml files using perl

Hi Everyone, I'm new here and I was checking this old post: /shell-programming-and-scripting/180669-splitting-file-into-several-smaller-files-using-perl.html (cannot paste link because of lack of points) I need to do something like this but understand very little of perl. I also check... (4 Replies)
Discussion started by: mcosta
4 Replies

10. Shell Programming and Scripting

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> ... (9 Replies)
Discussion started by: cozzin
9 Replies
XML::SAX::ExpatXS(3pm)					User Contributed Perl Documentation				    XML::SAX::ExpatXS(3pm)

NAME
XML::SAX::ExpatXS - Perl SAX 2 XS extension to Expat parser SYNOPSIS
use XML::SAX::ExpatXS; $handler = MyHandler->new(); $parser = XML::SAX::ExpatXS->new( Handler => $handler ); $parser->parse_uri($uri); #or $parser->parse_string($xml); DESCRIPTION
XML::SAX::ExpatXS is a direct XS extension to Expat XML parser. It implements Perl SAX 2.1 interface. See http://perl-xml.sourceforge.net/perl-sax/ for Perl SAX API description. Any deviations from the Perl SAX 2.1 specification are considered as bugs. Features The parser behavior can be changed by setting features. $parser->set_feature(FEATURE, VALUE); XML::SAX::ExpatXS provides these adjustable features: "http://xmlns.perl.org/sax/join-character-data" Consequent character data are joined (1, default) or not(0). "http://xmlns.perl.org/sax/ns-attributes" Namespace attributes are reported as common attributes (1, default) or not(0). "http://xmlns.perl.org/sax/xmlns-uris" When set on, xmlns and xmlns:* attributes are put into namespaces in a Perl SAX traditional way; xmlns attributes are in no namespace while xmlns:* attributes are in the "http://www.w3.org/2000/xmlns/" namespace. This feature is set to 1 by default. "http://xml.org/sax/features/xmlns-uris" This feature applies if and only if the "http://xmlns.perl.org/sax/xmlns-uris" feature is off. Then, xmlns and xmlns:* attributes are both put into no namespace (0, default) or into "http://www.w3.org/2000/xmlns/" namespace(1). "http://xmlns.perl.org/sax/locator" The document locator is updated (1, default) for ContentHadler events or not(0). "http://xmlns.perl.org/sax/recstring" A recognized string (the text string currently processed by this XML parser) is either maintained as $parser->{ParseOptions}{RecognizedString} (1) or not (0, default). "http://xml.org/sax/features/external-general-entities" Controls whether this parser processes external general entities (1, default) or not(0). "http://xml.org/sax/features/external-parameter-entities" Controls whether this parser processes external parameter entities including an external DTD subset(1) or not (0, default). Constructor Options Apart from features, the behavior of this parser can also be changed with options to the constructor. ParseParamEnt ParseParamEnt => 1 This option meaning is exactly the same as the "http://xml.org/sax/features/external-parameter-entities" feature. The option is supported only because of the compatibility with older versions of this module. Turned off by default. NoExpand NoExpand => 1 No internal entities are expanded if this option is turned on. Turned off by default. Read-only Properties ExpatVersion This property returns a version of linked Expat library, for example expat_1.95.7. AUTHORS
Petr Cimprich <petr AT gingerall DOT org> (maintainer) Matt Sergeant <matt AT sergeant DOT org> perl v5.14.2 2011-04-12 XML::SAX::ExpatXS(3pm)
All times are GMT -4. The time now is 10:59 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy