I have a file:
Fred
Fred
Fred
Jim
Fred
Jim
Jim
If sort is executed on the listed file, shouldn't the output be?:
Fred
Fred
Fred
Fred
Jim
Jim
Jim (3 Replies)
Using the last, uniq, sort and cut commands, determine how many times the different users have logged in.
I know how to use the last command and cut command...
i came up with last | cut -f1 -d" " | uniq
i dont know if this is right, can someone please help me... thanks (1 Reply)
Does anyone have a quick and dirty way of performing a sort and uniq in perl?
How an array with data like:
this is bkupArr BOLADVICE_VN
this is bkupArr MLT6800PROD2A
this is bkupArr MLT6800PROD2A
this is bkupArr BOLADVICE_VN_7YR
this is bkupArr MLT6800PROD2A
I want to sort it... (4 Replies)
Input File is :
-------------
25060008,0040,03,
25136437,0030,03,
25069457,0040,02,
80303438,0014,03,1st
80321837,0009,03,1st
80321977,0009,03,1st
80341345,0007,03,1st
84176527,0047,03,1st
84176527,0047,03,
20000735,0018,03,1st
25060008,0040,03,
I am using the following in the script... (5 Replies)
Hi All,
I have a text file with the format shown below. Some of the records are duplicated with the only exception being date (Field 15). I want to compare all duplicate records using subscriber number (field 7) and keep only those records with greater date.
... (1 Reply)
I have a flatfile A.txt
2012/12/04 14:06:07 |trees|Boards 2, 3|denver|mekong|mekong12
2012/12/04 17:07:22 |trees|Boards 2, 3|denver|mekong|mekong12
2012/12/04 17:13:27 |trees|Boards 2, 3|denver|mekong|mekong12
2012/12/04 14:07:39 |rain|Boards 1|tampa|merced|merced11
How do i sort and get... (3 Replies)
Hi again,
I have files with the following contents
datetime,ip1,port1,ip2,port2,number
How would I find out how many times ip1 field shows up a particular file? Then how would I find out how many time ip1 and port 2 shows up?
Please mind the file may contain 100k lines. (8 Replies)
Hi !
I am trying to remove doubbled entrys in a textfile only between delimiters.
Like that example but i dont know how to do that with sort or similar.
input:
{
aaa
aaa
}
{
aaa
aaa
}
output:
{
aaa
}
{ (8 Replies)
Hello all,
Need to pick your brains,
I have a 10Gb file where each row is a name, I am expecting about 50 names in total. So there are a lot of repetitions in clusters.
So I want to do a
sort -u file
Will it be considerably faster or slower to use a uniq before piping it to sort... (3 Replies)
Discussion started by: senhia83
3 Replies
LEARN ABOUT DEBIAN
stag-db
STAG-DB(1p) User Contributed Perl Documentation STAG-DB(1p)NAME
stag-db - persistent storage and retrieval for stag data (xml, sxpr, itext)
SYNOPSIS
stag-db -r person -k social_security_no -i ./person-idx myrecords.xml
stag-db -i ./person-idx -q 999-9999-9999 -q 888-8888-8888
DESCRIPTION
Builds a simple file-based database for persistent storage and retrieval of nodes from a stag compatible document.
Imagine you have a very large file of data, in a stag compatible format such as XML. You want to index all the elements of type person;
each person can be uniquely identified by social_security_no, which is a direct subnode of person
The first thing to do is to build an index file, which will be stored in your current directory:
stag-db -r person -k social_security_no -i ./person-idx myrecords.xml
You can then use the index "person-idx" to retrieve person nodes by their social security number
stag-db -i ./person-idx -q 999-9999-9999 > some-person.xml
You can export using different stag formats
stag-db -i ./person-idx -q 999-9999-9999 -w sxpr > some-person.xml
You can retrieve multiple nodes (although these need to be rooted to make a valid file)
stag-db -i ./person-idx -q 999-9999-9999 -q 888-8888-8888 -top personset
Or you can use a list of IDs from a file (newline delimited)
stag-db -i ./person-idx -qf my_ss_nmbrs.txt -top personset
ARGUMENTS
-i INDEXFILE
This file will be used as the persistent index for storage/retrieval
-r RELATION-NAME
This is the name of the stag node (XML element) that will be stored in the index; for example, with the XML below you may want to use the
node name person and the unique key id
<person_set>
<person>
<id>...</id>
</person>
<person>
<id>...</id>
</person>
...
</person_set>
This flag should only be used when you want to store data
-k UNIQUE-KEY
This node will be used as the unique/primary key for the data
This node should be nested directly below the node that is being stored in the index - if it is more that one below, specify a path
This flag should only be used when you want to store data
-u UNIQUE-KEY
Synonym for -k
-p PARSER
This can be the name of a stag supported format (xml, sxpr, itext) - XML is assumed by default
It can also be a module name - this module is used to parse the input file into a stag stream; see Data::Stag::BaseGenerator for details on
writing your own parsers/event generators
This flag should only be used when you want to store data
-q QUERY-ID
Fetches the relation/node with unique key value equal to query-id
Multiple arguments can be passed by specifying -q multple times
This flag should only be used when you want to query data
-top NODE-NAME
If this is specified in conjunction with -q or -qf then all the query result nodes will be nested inside a node with this name (ie this
provides a root for the resulting document tree)
-qf QUERY-FILE
This is a file of newline-seperated IDs; this is useful for querying the index in batch
-keys
This will write a list of all primary keys in the index
-w WRITER
This format will be used to write the data; can be any stag format (xml, sxpr, itext) - default XML.
Can also be a module that catches the incoming stag event stream and does something with it (for example, this could be a module you write
yourself that transforms the stag events into HTML)
SEE ALSO
Data::Stag
For more complex stag to database mapping, see DBIx::DBStag and the scripts
stag-storenode
selectall_xml
perl v5.10.0 2008-12-23 STAG-DB(1p)