assume your post is just some sample data, so really up to your criteria base on what to categorize them into one, if simply as 'old' and 'new'. Then maybe below perl script can help you some:
Hi,
I have this scenario; where there are two classes:- apple and orange.
1,2,3,4,5,6,apple
1,1,0,4,2,3,apple
1,3,3,3,3,4,apple
1,1,1,1,1,1,orange
1,2,3,1,1,1,orange
Basically for apple, i have 3 entries in the file, and for orange, I have 2 entries. Im trying to edit the file and find... (5 Replies)
Hello,
I have a log file with the following input:
X , ID , Date, Time, Y
01,01368,2010-12-02,09:07:00,Pass
01,01368,2010-12-02,10:54:00,Pass
01,01368,2010-12-02,13:07:04,Pass
01,01368,2010-12-02,18:54:01,Pass
01,01368,2010-12-03,09:02:00,Pass
01,01368,2010-12-03,13:53:00,Pass... (12 Replies)
Hello again, I am wanting to remove all duplicate blocks of XML code in a file. This is an example:
input:
<string-array name="threeItems">
<item>item1</item>
<item>item2</item>
<item>item3</item>
</string-array>
<string-array name="twoItems">
<item>item1</item>
<item>item2</item>... (19 Replies)
Hi
My file have 7 column, FIle is pipe delimed
Col1|Col2|col3|Col4|col5|Col6|Col7
I want to find out uniq record count on col3, col4 and col2 ( same order) how can I achieve it.
ex
1|3|A|V|C|1|1
1|3|A|V|C|1|1
1|4|A|V|C|1|1
Output should be
FREQ|A|V|3|2
FREQ|A|V|4|1
Here... (5 Replies)
I met a challenge to filter ~70 millions of sequence rows and I want using awk with conditions:
1) longest string of each pattern in column 2, ignore any sub-string, as the index;
2) all the unique patterns after 1);
3) print the whole row;
input:
1 ABCDEFGHI longest_sequence1
2 ABCDEFGH... (12 Replies)
Within a shell script I use
uniq -w 16 -D
in order to process all lines in which the first 16 characters are duplicated.
Now I want to also run that script on a BSD based system where the included version of uniq does not support the -w (--check-chars) option. To get around this I have... (7 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 all
I was wondering if you may help me in resolving an issue.
In particular I have a file like this:
the ... represent different string and what I wrote Cur or Ent are the constant.
Well, what I would like to obtain is a file in which are reported only the ID in which the second column... (6 Replies)
Hi Help,
I have a file which looks like
1 20 30 40 50 60 6
2 20 30 40 50 60 8
7 20 30 40 50 60 7
4 30 40 50 60 70 8
5 30 40 50 60 70 9
2 30 40 50 60 70 8
I want the o/p as
1 20 30 40 50 60 6
4 30 40 50 60 70 8
Is there a way I can use uniq command or awk to do this?
... (11 Replies)
Discussion started by: Indra2011
11 Replies
LEARN ABOUT DEBIAN
hashdelete
HASHSTASH(3) libbash hashstash Library Manual HASHSTASH(3)NAME
hashstash -- libbash library that implements hash data structure
SYNOPSIS
hashSet <Value> <Key> <HashName> [SubHashName [...]]
$retval hashGet <Key> <HashName> [SubHashName [...]]
$retval hashKeys <HashName> [SubHashName [...]]
hashRemove <Key> <HashName> [SubHashName [...]]
hashDelete <HashName> [SubHashName [...]]
DESCRIPTION
General
hashstash is a collection of functions that implement basic hash data-structure in bash scripting language.
The function list:
hashSet Adds a value to the hash
hashGet Returns a value from the hash
hashKeys Returns a list of keys of the hash
hashRemove Removes a key from the hash
hashDelete Deletes a hash
Detailed interface description follows.
FUNCTIONS DESCRIPTIONS
hashSet <Value> <Key> <Hashname> [SubHashName [...]]
Adds a value to the hash.
Parameters:
<Value>
The value to set in HashName[Key].
<Key>
The key for the value Value.
<HashName> [SubHashName [...]]
A string that contains the name of the hash. If the hash is a sub hash of another hash, the "father hash" name MUST BE WRITTEN FIRST,
followed by the sub-hash name.
Value will be the value of the key Key in the hash HashName. For example if you have (or want to define) hash C, which is subhash of hash B,
which is subhash of hash A, and C has a key named ckey1 with value cval1, then you should use:
hashSet cval1 ckey1 A B C
$retval hashGet <Key> <HashName> [SubHashName [...]]
Returns the value of Key in HashName to the $retval variable.
Parameters:
<Key>
The key that hold the value we wish to get.
<HashName> [SubHashName [...]]
A string that contains the name of the hash. If the hash is a sub hash of another hash, the "father hash" name MUST BE WRITTEN FIRST,
followed by the sub-hash name.
Return Value:
The value of the key Key in the hash HashName. The value is returned in the variable $retval.
$retval hashKeys <HashName> [SubHashName [...]]
Returns a list of keys of the hash HashName in the variable $retval.
Parameters:
<HashName> [SubHashName [...]]
A string that contains the name of the hash. If the hash is a sub hash of another hash, the "father hash" name MUST BE WRITTEN FIRST,
followed by the sub-hash name.
Return Value:
The value of the key Key in the hash HashName. The value is returned in the variable $retval.
hashRemove <Key> <HashName> [SubHashName [...]]
Removes the key Key from the hash HashName.
<Key>
The key we wish to remove from HashName.
<HashName> [SubHashName [...]]
A string that contains the name of the hash. If the hash is a sub hash of another hash, the "father hash" name MUST BE WRITTEN FIRST,
followed by the sub-hash name.
This function should also be used to remove a sub-hash from its "father hash". In that case, the key will be the name of the sub-hash.
hashDelete <HashName> [SubHashName [...]]
Deletes the hash HashName [SubHashName [...]].
Parameters:
<HashName> [SubHashName [...]]
A string that contains the name of the hash. If the hash is a sub hash of another hash, the "father hash" name MUST BE WRITTEN FIRST,
followed by the sub-hash name.
If this function is used on a sub-hash, a key with the name of the sub-hash will remain in its "father hash" and will hold a NULL value.
BUGS
A hash name can only contain characters that are valid as part of bash variable names (i.e. a-zA-Z0-9_). The same applies for hash keys.
As for now, there is no way of knowing if a key represents a value or a sub-hash. If a sub-hash will be used as a key, the returned value
will be its keys list.
EXAMPLES
Define hash table hashA with key Akey1 with value Aval1 use:
% hashSet Aval1 Akey1 Ahash
Now:
% hashGet Akey1 Ahash
% echo $retval
Aval1
% hashKeys Ahash
% echo $retval
Akey1
%
HISTORY
The idea to write hashstash library appeared when we've discovered the full power of the bash eval function.
As of the name hashstash, it has two meanings. The first, it means 'stash' of hash functions. The second is, that hashstash contains sub-
hashes inside, so it looks like stash of packed information.
AUTHORS
Hai Zaar <haizaar@haizaar.com>
Gil Ran <gil@ran4.net>
SEE ALSO ldbash(1), libbash(1)Linux Epoch Linux