03-24-2008
Avoiding duplicates with some special case
Hi Gurus,
I had a question regarding avoiding duplicates.i have a file abc.txt
abc.txt
-------
READER_1_1_1> HIER_28056 XML Reader: Error [UnterminatedXMLDecl] occurred while parsing:[Error at (file /home/abc.xml, line 6, char 1 ): Invalid document structure.]; line number [6]; column number [1]
READER_1_3_1> Sun Mar 23 23:52:48 2008
READER_1_3_1> HIER_28056 XML Reader: Error [UnterminatedXMLDecl] occurred while parsing:[Error at (file /home/abc.xml, line 6, char 1 ): Invalid document structure.]; line number [6]; column number [1]
READER_1_2_1> Sun Mar 23 23:52:48 2008
READER_1_2_1> HIER_28056 XML Reader: Error [UnterminatedXMLDecl] occurred while parsing:[Error at (file /home/abc.xml, line 6, char 1 ): Invalid document structure.]; line number [6]; column number [1]
READER_1_1_1> Sun Mar 23 23:52:48 2008
READER_1_1_1> HIER_28058 XML Reader Error
READER_1_2_1> Sun Mar 23 23:52:48 2008
READER_1_2_1> HIER_28058 XML Reader Error
READER_1_3_1> Sun Mar 23 23:52:48 2008
READER_1_3_1> HIER_28058 XML Reader Error.
I will get this file when i egrep the session log file for error specific messages.
here i want to remove the repeated lines in this file?
i am try to use uniq command, but here READER_1_3_1> will be varying in the above abc.txt file
i.e., in every line we have 1,2,3 in place of READER_1_**_1>.
So i am not getting the desired output.
Can any one let me know how to get the requirement done.
My output should be
READER_1_1_1> HIER_28056 XML Reader: Error [UnterminatedXMLDecl] occurred while parsing:[Error at (file /home/abc.xml, line 6, char 1 ): Invalid document structure.]; line number [6]; column number [1]
READER_1_1_1> HIER_28058 XML Reader Error
And one more question is there any way to trace out only error messages from session log file using any command?
Thanks & Regards,
San
10 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
Hello,
Today, as a root user, i want to copy recursively all files and diretories in a source directory to a destination directory using the following command,
cp -r /home/smith/* /home/bob/
However, I carelessly missed the '*' out when I executed the command.
Now, i noticed a... (1 Reply)
Discussion started by: cy163
1 Replies
2. UNIX for Dummies Questions & Answers
hello all
i have a big problems for me
if i have more files as example
test.ghrt.part01.rar
test.ghrt.part02.rar
test.ghrt.part03.rar
test.ghrt.part04.rar
test.ghrt.part05.rar
test.ghrt.part06.rar
test.ghrt.part07.rar
test.ghrt.part08.rar
test.ghrt.part09.rar
test.ghrt.part10.rar... (13 Replies)
Discussion started by: ateya
13 Replies
3. Shell Programming and Scripting
I made menu script for users so they can run other script without going in shell just from menu.
But i must control their input.
These are criteria:
Input must have 4 signs
First two signs are always lower case letters
Input shall not have some special signs just letters and numbers
... (1 Reply)
Discussion started by: waso
1 Replies
4. Shell Programming and Scripting
Hi. Let me start saying that i am kinda new to bash, and have few skills in programming. I've been advised to use bash to manipulate large .csv files. I've been able to do some data filtering using fors, grep and tail commands. That was kinda easy seeing examples. But now i need to do some hard... (1 Reply)
Discussion started by: jmarmitt
1 Replies
5. UNIX for Dummies Questions & Answers
In bash shell, how we can avoid the commands getting recorded in history file.
One way i can think of is :
export HISTSIZE=0
Is there any other way to achieve this?
Thanks (1 Reply)
Discussion started by: pandeesh
1 Replies
6. Shell Programming and Scripting
complinagetest () #function name
{
if ;then
rm complins.dat
fi
touch complins.dat
i=0
while read line
do
if ; then
va=`grep -w "$line" datalins1.dat | awk BEGIN'{FS="\`~"}{if ( $3=="'$line'" ) {print $4}}'`
i=$(($i+1))
varits=$(echo $va|awk -v varif="$i" '{print... (1 Reply)
Discussion started by: amitpaul01
1 Replies
7. Shell Programming and Scripting
14`~abc`~9`~11
14`~abc`~9`~10
36`~ee`~7`~9
36`~ee`~8`~9
58`~rtt`~12`~7
70`~gff`~13`~8
86`~tyu`~6`~12
86`~tyu`~6`~13
92`~mjh`~5`~6
28`~jkl`~10`~DNA
32`~mjk`~SNA`~5
82`~jkli`~11`~DNA
------------------------------------
Field Seperator: `~
The concept is to start with SNA in the 3rd... (8 Replies)
Discussion started by: barath
8 Replies
8. Shell Programming and Scripting
Hi all,
I have a list which I want to search in another file.
I can do that using
grep -f
but the search is failing due to special characters, how do I solve this?
One row in that list is
amino-acid permease inda1 gb|EDU41782.1| amino-acid permease inda1 Input file to be searched... (2 Replies)
Discussion started by: gina.lizar
2 Replies
9. Shell Programming and Scripting
I have a special case that awk could be used but I do not have the skill. Trying to create a final output file (indel_parse.txt) that is created from using some information from each of the two files (attached).
parse rules:
The header is skipped FNR>1
1. 4 zeros after the NC_ (not... (2 Replies)
Discussion started by: cmccabe
2 Replies
10. Shell Programming and Scripting
In the bash menu below if the variant that is inputted is in the format NM_004004.3:c.274G>T the below works perfectly. My question is if the variant inputted isNM_004004.3:-c.274G>T or NM_004004.3:+c.274G>T then the code as is will throw an error due to a biological issue. Is it possible to to... (1 Reply)
Discussion started by: cmccabe
1 Replies
LEARN ABOUT SUSE
xml::libxml::error
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)