Hi,
May I know, if a pipe separated File is large, what is the best method to calculate the unique row count of 3rd column and get a list of unique value of the 3rdcolum?
Thanks in advance! (20 Replies)
Hi ,
I have
#echo $var1
#hdisk2 hdisk3 hdisk0 hdisk2
Now I need to remove duplicate entries from this . ie. after sorting it should only have
hdisk2 hdisk3 hdisk0 .
I can have these values in a array as well . I understand we can use sort -u to remove the duplicates in a... (2 Replies)
Hi all,
I've searched the forum and I can find some code to sort uniquely in perl but not by a single field.
I have a file with data such as the following:
1,test,34
1,test2,65
2,test,35,
1,test3,34
2,test,34
What i want to do is sort it uniqely by the first field only so I'd end... (2 Replies)
Hi all,
I am writing a script where i can parse through the directory and get common string in two directories i get. The command below SUN_PLATFORM=`$FIND $STREAM_PATH . -depth -name ShareableEntities | $AWK -F"/" '{if($10 ~ /sun5/) print $0}'` gives the following output:-
... (1 Reply)
Input file
---------
12:name1:|host1|host1|host2|host1
13:name2:|host1|host1|host2|host3
14:name3:
......
Required output
---------------
12:name1:host1(2)|host1(1)
13:name2:host1(2)|host2(1)|host3(1)
14:name3:
where (x) - Count how many times field appears in last column
... (3 Replies)
I have a file with contents below
123,502
123,506
123,702
234,101
235,104
456,104
456,100
i want to sort such that i get a unique value in column A, and for those with multiple value in A, i want the lowest value in B.
output should be
123,502
234,101
235,104
456,100 (3 Replies)
I have another file with three columns A,B,C as below
123,1,502
123,2,506
123,3,702
234,4,101
235,5,104
456,6,104
456,7,100
i want to sort such that i get a unique value in column A, and for those with multiple value in A, i want the lowest value in C.
output should be
Code:... (3 Replies)
Hi, this is about sorting a very large file (like 10 gb) to keep lines with unique entries across SOME of the columns.
The line originally looked like this:
sort -u -k2,2 -k3,3n -k4,4n -k5,5n -k6,6n file_unsorted > file_sorted
please note the -u flag.
The problem is that this single... (4 Replies)
I would like to print unique lines without sort or unique. Unfortunately the server I am working on does not have sort or unique. I have not been able to contact the administrator of the server to ask him to add it for several weeks. (7 Replies)
i need to sort to get all the unique records based on the 1st and 2nd column, and keep the record with the highest value on 5th column if there are duplicates, every column with varies length
a^2^x^y^z
bxc^2xx2^aa^bvxxxx^cdd
a^3^1^2^3
a^2^x^1^c
I want a result which will only keep the 1st... (2 Replies)
Discussion started by: dtdt
2 Replies
LEARN ABOUT DEBIAN
xml::filter::sort::buffer
XML::Filter::Sort::Buffer(3pm) User Contributed Perl Documentation XML::Filter::Sort::Buffer(3pm)NAME
XML::Filter::Sort::Buffer - Implementation class used by XML::Filter::Sort
DESCRIPTION
The documentation is targetted at developers wishing to extend or replace this class. For user documentation, see XML::Filter::Sort.
For an overview of the classes and methods used for buffering, see XML::Filter::Sort::BufferMgr.
BUFFER LIFE CYCLE
A XML::Filter::Sort::Buffer object is created by a XML::Filter::Sort::BufferMgr object using the "new()" method.
The XML::Filter::Sort object will then propagate any SAX events it receives, to the buffer object until the end of the record is reached.
As each element is added to the buffer, its contents are compared to the sort key paths and the sort key values are extracted.
When the end of the record is reached, the "close()" method is called. The return value from this method is the list of sort keys.
The buffer manager will store the buffer until the end of the record sequence is reached. Then it will retrieve each buffer in order of
the sort key values and call the buffer's "to_sax()" method to send all buffered events to the downstream handler.
Following the call to "to_sax()", the buffer is discarded. No destructor method is used - everything is handled by Perl's garbage
collector.
DATA STRUCTURES
The buffer contains a 'tree' of SAX events. The tree is simply an array of 'nodes'. Text nodes are represented as scalars. Other nodes
are represented as arrayrefs. The first element of a node array is a single character identifying the node type:
e - element
c - comment
p - processing instruction
The second element is the node data (the hash from the original SAX event). The child nodes of an element node are represented by the
third element as an arrayref.
For example, this XML:
<person age="27">
<lastname>smith</lastname>
</person>
Would be buffered as this data structure:
[
[
'e',
{
'Name' => 'person'
'Prefix' => '',
'LocalName' => 'person',
'NamespaceURI' => '',
'Attributes' => {
'{}age' => {
'LocalName' => 'age',
'NamespaceURI' => '',
'Value' => '27',
'Prefix' => '',
'Name' => 'age'
}
},
},
[
"
",
[
'e',
{
'Name' => 'lastname'
'Prefix' => '',
'LocalName' => 'lastname',
'NamespaceURI' => '',
'Attributes' => {},
},
[
'smith'
]
],
"
",
]
]
]
COPYRIGHT
Copyright 2002 Grant McLean <grantm@cpan.org>
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
perl v5.12.4 2005-04-20 XML::Filter::Sort::Buffer(3pm)