Sponsored Content
Full Discussion: split string using separetor
Top Forums Shell Programming and Scripting split string using separetor Post 302120389 by anbu23 on Wednesday 6th of June 2007 08:02:06 AM
Old 06-06-2007
Code:
string="abc@hotmail.com;xyz@gmail.com;uvw@yahoo.com"
str1=${string%%;*}
str3=${string##*;}
temp=${string#$str1;}
str2=${temp#;$str3}

These 2 Users Gave Thanks to anbu23 For This Post:
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

split a string

Hi I have a script that loops though lines of a file and reads each line in to a variable ($LINE). I want to look at the line and split it into it's constituent parts. e.g. a line might be "This is a string" I want to then have variables set to each element thus: A=This B=is C=a... (3 Replies)
Discussion started by: gazingdown
3 Replies

2. Shell Programming and Scripting

split string help

could anyone help in running split cmd split("String1,outputArray,"delimiter); with sample script?. for eg i have abc-def-ghi-sdf- my ultimate aim of asking this is i have a string containing hypens, i want to get the string before last n(2) Hypens (4 Replies)
Discussion started by: senthilk615
4 Replies

3. Shell Programming and Scripting

Split A String

Hi, I am new to scripting and need help splitting a string using space as the delimiter. How can I do that? I want the result to be stored in an Array. I tried using set -A arr $(echo $FILE) echo $arr The result of the above was ''. Thanks. (2 Replies)
Discussion started by: newbie187
2 Replies

4. Shell Programming and Scripting

split the string

I need to split the string msu1_2 It should be generic for any string of the form msu<digits>_<digits> so that i get $X =1 and $Y = 2 Please help Thanks (5 Replies)
Discussion started by: asth
5 Replies

5. Shell Programming and Scripting

Split string

Hi, can we split a number like this.. if i have something like 85743975945738, can it be converted as 8574-3975-945738 in ksh shell using single command... Thanks! (5 Replies)
Discussion started by: nram_krishna@ya
5 Replies

6. Shell Programming and Scripting

split string

Hi I am facing a problem in spitting a string. Here is the string -------------------- subject1=10;subject2=30;subject3=40;subjectcode=10001;... Now, I want only marks not the subject code. (there can be 'n' subjects) ie. 10 30 40 My doubt ---------- How do I... (5 Replies)
Discussion started by: jionnet
5 Replies

7. Shell Programming and Scripting

split string

I am trying to get some data from a file and print it on the same line. I have a script that gets the body of emails and display it, but i want it to display each emails body in one line no matter how big it is. eg insted of this email1: bla bla bla bla bla bla bal email2: bla bla bla... (7 Replies)
Discussion started by: maddog21
7 Replies

8. Shell Programming and Scripting

Need to split a string

Hi, We have a SunOS 5.10 Generic_142900-13 sun4v sparc SUNW,T5240. I'm trying to find a way to split a string into 2 variables. Ex: parm1="192.168.1.101/parent/child" What I need to do is split the string above into: host="192.168.1.101" location="parent/child" I saw the... (3 Replies)
Discussion started by: adshocker
3 Replies

9. Shell Programming and Scripting

Split the string in perl

Hi All, How to split the string KAR_Celltick_Ban_GSMGW3 and want to pickup the third filed. Sometime the string may be "KAR_Celltick_Ban" like this Thanks in advance (1 Reply)
Discussion started by: sujit_kashyap
1 Replies

10. UNIX for Beginners Questions & Answers

How to split a string into array?

value=malayalam # i need to store the value in an array by splitting the character #the output i need is m a l a y a l a m Please use CODE tags for output data as well as required by forum rules! (5 Replies)
Discussion started by: Meeran Rizvi
5 Replies
XML::LibXML::Error(3)					User Contributed Perl Documentation				     XML::LibXML::Error(3)

NAME
XML::LibXML::Error - Structured Errors SYNOPSIS
eval { ... }; if (ref($@)) { # handle a structured error (XML::LibXML::Error object) } elsif ($@) { # error, but not an XML::LibXML::Error object } else { # no error } $XML::LibXML::Error::WARNINGS=1; $message = $@->as_string(); print $@->dump(); $error_domain = $@->domain(); $error_code = $@->code(); $error_message = $@->message(); $error_level = $@->level(); $filename = $@->file(); $line = $@->line(); $nodename = $@->nodename(); $error_str1 = $@->str1(); $error_str2 = $@->str2(); $error_str3 = $@->str3(); $error_num1 = $@->num1(); $error_num2 = $@->num2(); $string = $@->context(); $offset = $@->column(); $previous_error = $@->_prev(); DESCRIPTION
The XML::LibXML::Error class is a tiny frontend to libxml2's structured error support. If XML::LibXML is compied with structured error support, all errors reported by libxml2 are transformed to XML::LibXML:Error objects. These objects automatically serialize to the corresponding error messages when printed or used in a string operation, but as objects, can also be used to get a detailed and structured information about the error that occurred. Unlike most other XML::LibXML objects, XML::LibXML::Error doesn't wrap an underlying libxml2 structure directly, but rather transforms it to a blessed Perl hash reference containing the individual fields of the structured error information as hash key-value pairs. Individual items (fields) of a structured error can either be obtained directly as $@->{field}, or using autoloaded methods such as as $@->field() (where field is the field name). XML::LibXML::Error objects have the following fields: domain, code, level, file, line, nodename, message, str1, str2, str3, num1, num2, and _prev (some of them may be undefined). $XML::LibXML::Error::WARNINGS $XML::LibXML::Error::WARNINGS=1; Traditionally, XML::LibXML was supressing parser warnings by setting libxml2's global variable xmlGetWarningsDefaultValue to 0. Since 1.70 we do not change libxml2's global variables anymore; for backward compatibility, XML::LibXML suppresses warnings. This variable can be set to 1 to enable reporting of these warnings via Perl "warn" and to 2 to report hem via "die". $message = $@->as_string(); This functions takes serializes a XML::LibXML::Error object to a string containing the full error message close to the message produced by libxml2 default error handlers and tools like xmllint. This method is also used to overload "" operator on XML::LibXML::Error, so it is automatically called whenever XML::LibXML::Error object is treated as a string (e.g. in print $@). dump print $@->dump(); This function serializes a XML::LibXML::Error to a string displaying all fields of the error structure individually on separate lines of the form 'name' => 'value'. domain $error_domain = $@->domain(); Returns string containing information about what part of the library raised the error. Can be one of: "parser", "tree", "namespace", "validity", "HTML parser", "memory", "output", "I/O", "ftp", "http", "XInclude", "XPath", "xpointer", "regexp", "Schemas datatype", "Schemas parser", "Schemas validity", "Relax-NG parser", "Relax-NG validity", "Catalog", "C14N", "XSLT", "validity". code $error_code = $@->code(); Returns the actual libxml2 error code. The XML::LibXML::ErrNo module defines constants for individual error codes. Currently libxml2 uses over 480 different error codes. message $error_message = $@->message(); Returns a human-readable informative error message. level $error_level = $@->level(); Returns an integer value describing how consequent is the error. XML::LibXML::Error defines the following constants: o XML_ERR_NONE = 0 o XML_ERR_WARNING = 1 : A simple warning. o XML_ERR_ERROR = 2 : A recoverable error. o XML_ERR_FATAL = 3 : A fatal error. file $filename = $@->file(); Returns the filename of the file being processed while the error occurred. line $line = $@->line(); The line number, if available. nodename $nodename = $@->nodename(); Name of the node where error occurred, if available. When this field is non-empty, libxml2 actually returned a physical pointer to the specified node. Due to memory management issues, it is very difficult to implement a way to expose the pointer to the Perl level as a XML::LibXML::Node. For this reason, XML::LibXML::Error currently only exposes the name the node. str1 $error_str1 = $@->str1(); Error specific. Extra string information. str2 $error_str2 = $@->str2(); Error specific. Extra string information. str3 $error_str3 = $@->str3(); Error specific. Extra string information. num1 $error_num1 = $@->num1(); Error specific. Extra numeric information. num2 $error_num2 = $@->num2(); In recent libxml2 versions, this value contains a column number of the error or 0 if N/A. context $string = $@->context(); For parsing errors, this field contains about 80 characters of the XML near the place where the error occurred. The field "$@->column()" contains the corresponding offset. Where N/A, the field is undefined. column $offset = $@->column(); See "$@->column()" above. _prev $previous_error = $@->_prev(); This field can possibly hold a reference to another XML::LibXML::Error object representing an error which occurred just before this error. AUTHORS
Matt Sergeant, Christian Glahn, Petr Pajas VERSION
1.70 COPYRIGHT
2001-2007, AxKit.com Ltd. 2002-2006, Christian Glahn. 2006-2009, Petr Pajas. perl v5.12.1 2009-10-07 XML::LibXML::Error(3)
All times are GMT -4. The time now is 12:57 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy