Sponsored Content
Top Forums Shell Programming and Scripting Perl : to split the tags from xml file Post 302782149 by scriptscript on Monday 18th of March 2013 10:41:07 AM
Old 03-18-2013
Great thanks tyler...

Could you also please provide the equivalent perl script for the same.

Thanks once again...

*****************************

Also I tried the below code to get the desired output but no luck...


Code:
open(DAT, "xml.log") || die("Could not open file!");
while ( $content = <DAT> )
{
  if ($content =~ /(<hyperlink.*?>)/g)
  {
      print "$1\n";
  }
}


Last edited by scriptscript; 03-18-2013 at 12:31 PM..
 

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

Shell script to split XML file

Hi, I'm experiencing difficulty in loading an XML file to an Oracle destination table.I keep running into a memory problem due to the large size of the file. I want to split the XML file into several smaller files based on the keyword(s)/tags : '' and '' and would like to use a Unix shell... (2 Replies)
Discussion started by: bayflash27
2 Replies

3. Shell Programming and Scripting

Need to split a xml file in proper format

Hi, I have a file which has xml data but all in single line Ex - <?xml version="1.0"?><User><Name>Robert</Name><Location>California</Location><Occupation>Programmer</Occupation></User> I want to split the data in proper xml format Ex- <?xml version="1.0"?> <User> <Name>Robert</Name>... (6 Replies)
Discussion started by: avishek007
6 Replies

4. Shell Programming and Scripting

Split a 30GB XML file into 16 pieces

I have a 30 GB XMl file which looks like this: <page> <title>APRIL</title> .........(text contents that I need to extract and store in 1.dat including the <title> tag) </page> <page> <title>August</title> ....(text contents that I need to store in 2.dat including the <title> tag) </page>... (13 Replies)
Discussion started by: shoaibjameel123
13 Replies

5. Shell Programming and Scripting

Split xml file into many

Hi, I had a scenario need a help as I am new to this. I have a xml file employee.xml with the below content. <Organisation><employee>xxx</employee><employee>yyy</employee><employee>zzz</employee></Organisation> I want to split the file into multiple file as below. Is there a specifice way... (5 Replies)
Discussion started by: mankuar
5 Replies

6. Shell Programming and Scripting

How to add the multiple lines of xml tags before a particular xml tag in a file

Hi All, I'm stuck with adding multiple lines(irrespective of line number) to a file before a particular xml tag. Please help me. <A>testing_Location</A> <value>LA</value> <zone>US</zone> <B>Region</B> <value>Russia</value> <zone>Washington</zone> <C>Country</C>... (0 Replies)
Discussion started by: mjavalkar
0 Replies

7. Shell Programming and Scripting

Split XML file

Hi Experts, Can you please help me to split following XML file based on new Order ? Actual file is very big. I have taken few lines of it. <?xml version="1.0" encoding="utf-8" standalone="yes"?> <Orders xmlns='http://www.URL.com/Orders'> <Order> <ORDNo>450321</ORDNo> ... (3 Replies)
Discussion started by: meetmedude
3 Replies

8. Shell Programming and Scripting

Split XML file based on tags

Hello All , Please help me with below requirement I want to split a xml file based on tag.here is the file format <data-set> some-information </data-set> <data-set1> some-information </data-set1> <data-set2> some-information </data-set2> I want to split the above file into 3... (5 Replies)
Discussion started by: Pratik4891
5 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

Split xml file into multiple xml based on letterID

Hi All, We need to split a large xml into multiple valid xml with same header(2lines) and footer(last line) for N number of letterId. In the example below we have first 2 lines as header and last line as footer.(They need to be in each split xml file) Header: <?xml version="1.0"... (5 Replies)
Discussion started by: vx04
5 Replies
Dancer::FileUtils(3pm)					User Contributed Perl Documentation				    Dancer::FileUtils(3pm)

NAME
Dancer::FileUtils - helper providing file utilities SYNOPSIS
use Dancer::FileUtils qw/dirname path/; # for 'path/to/file' my $dir = dirname($path); # returns 'path/to' my $path = path($path); # returns '/abs/path/to/file' use Dancer::FileUtils qw/path read_file_content/; my $content = read_file_content( path( 'folder', 'folder', 'file' ) ); my @content = read_file_content( path( 'folder', 'folder', 'file' ) ); use Dancer::FileUtils qw/read_glob_content set_file_mode/; open my $fh, '<', $file or die "$! "; set_file_mode($fh); my @content = read_file_content($fh); my $content = read_file_content($fh); DESCRIPTION
Dancer::FileUtils includes a few file related utilities related that Dancer uses internally. Developers may use it instead of writing their own file reading subroutines or using additional modules. SUBROUTINES
/METHODS dirname use Dancer::FileUtils 'dirname'; my $dir = dirname($path); Exposes File::Basename's dirname, to allow fetching a directory name from a path. On most OS, returns all but last level of file path. See File::Basename for details. open_file use Dancer::FileUtils 'open_file'; my $fh = open_file('<', $file) or die $message; Calls open and returns a filehandle. Takes in account the 'charset' setting from Dancer's configuration to open the file in the proper encoding (or defaults to utf-8 if setting not present). path use Dancer::FileUtils 'path'; my $path = path( 'folder', 'folder', 'filename'); Provides comfortable path resolving, internally using File::Spec. read_file_content use Dancer::FileUtils 'read_file_content'; my @content = read_file_content($file); my $content = read_file_content($file); Returns either the content of a file (whose filename is the input), undef if the file could not be opened. In array context it returns each line (as defined by $/) as a separate element; in scalar context returns the entire contents of the file. read_glob_content use Dancer::FileUtils 'read_glob_content'; open my $fh, '<', $file or die "$! "; my @content = read_glob_content($fh); my $content = read_glob_content($fh); Same as read_file_content, only it accepts a file handle. Returns the content and closes the file handle. set_file_mode use Dancer::FileUtils 'set_file_mode'; set_file_mode($fh); Applies charset setting from Dancer's configuration. Defaults to utf-8 if no charset setting. EXPORT
Nothing by default. You can provide a list of subroutines to import. AUTHOR
Alexis Sukrieh LICENSE AND COPYRIGHT
Copyright 2009-2011 Alexis Sukrieh. This program is free software; you can redistribute it and/or modify it under the terms of either: the GNU General Public License as published by the Free Software Foundation; or the Artistic License. See http://dev.perl.org/licenses/ for more information. perl v5.14.2 2012-01-27 Dancer::FileUtils(3pm)
All times are GMT -4. The time now is 11:53 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy