I have following file content (3 fields each line):
23 888 10.0.0.1
dfh 787 10.0.0.2
dssf dgfas 10.0.0.3
dsgas dg 10.0.0.4
df dasa 10.0.0.5
df dag 10.0.0.5
dfd dfdas 10.0.0.5
dfd dfd 10.0.0.6
daf nfd 10.0.0.6
...
as can be seen, that the third field is ip address and sorted. but... (3 Replies)
I have a log file "logreport" that contains several lines as seen below:
04:20:00 /usr/lib/snmp/snmpdx: Agent snmpd appeared dead but responded to ping
06:38:08 /usr/lib/snmp/snmpdx: Agent snmpd appeared dead but responded to ping
07:11:05 /usr/lib/snmp/snmpdx: Agent snmpd appeared dead but... (18 Replies)
I have a data set that has 4 columns, I want to know if I can delete duplicate lines while ignoring one of the columns, for example
10 chr1 ASF 30
15 chr1 ASF 20
5 chr1 ASF 30
6 chr2 EBC 15
4 chr2 EBC 30
...
I want to know if I can delete duplicate lines while ignoring column 1, so the... (5 Replies)
Hi
I want to make string substitution ignoring case for search but respecting case for subtitute. Ex changing all occurences of "original" in a file to "substitute":
original becomes substitute
Origninal becomes Substitute
ORIGINAL becomes SUBSTITUTE
I know this a little special but it's not... (1 Reply)
Hi, I have a huge file which is about 50GB. There are many lines. The file format likes
21 rs885550 0 9887804 C C T C C C C C C C
21 rs210498 0 9928860 0 0 C C 0 0 0 0 0 0
21 rs303304 0 9941889 A A A A A A A A A A
22 rs303304 0 9941890 0 A A A A A A A A A
The question is that there are a few... (4 Replies)
I have this structure:
col1 col2 col3 col4 col5
27 xxx 38 aaa ttt
2 xxx 38 aaa yyy
1 xxx 38 aaa yyy
I need to collapse duplicate lines ignoring column 1 and add values of duplicate lines (col1) so it will look like this:
col1 col2 col3 col4 col5
27 xxx 38 aaa ttt ... (3 Replies)
Within my text file i have several thousand lines of text with some lines containing duplicate strings/words. I would like to entirely remove those lines which contain the duplicate strings.
Eg;
One and a Two
Unix.com is the Best
This as a Line Line
Example duplicate sentence with the word... (22 Replies)
Hi All,
I am storing the result in the variable result_text using the below code.
result_text=$(printf "$result_text\t\n$name") The result_text is having the below text. Which is having duplicate lines.
file and time for the interval 03:30 - 03:45
file and time for the interval 03:30 - 03:45 ... (4 Replies)
Discussion started by: nalu
4 Replies
LEARN ABOUT OSX
cache_release_value
cache_set_and_retain(3) BSD Library Functions Manual cache_set_and_retain(3)NAME
cache_set_and_retain, cache_get_and_retain, cache_release_value, cache_remove -- Routines used to manage cached values
SYNOPSIS
#include <cache.h>
int
cache_set_and_retain(cache_t *cache, void *key, void *value, size_t cost);
int
cache_get_and_retain(cache_t *cache, void *key, void **value_out);
int
cache_release_value(cache_t *cache, void *value);
int
cache_remove(cache_t *cache, void *key);
DESCRIPTION
These routines are used to manipulate values added to an in memory cache created by cache_create(3).
cache_set_and_retain() Adds value with cost to cache and associates it with key. The caller retains a reference to value that will prevent
value from being evicted from the cache until value is released in cache_release_value().
cache_get_and_retain() Fetches value for key from cache and places value in value_out. The caller retains a reference to value that will
prevent value from being evicted from the cache until value is release in cache_release_value().
cache_release_value() Releases a reference on value back to cache so that value may be evicted. Signals that the client is not actively
using value and will use cache_get_and_retain() before using again.
cache_remove() Removes the value associated with key from cache. Note that if the value is referenced by a client, the value will not be
finalized until the reference is released using cache_release_value().
RETURN VALUES
All functions return 0 for success and non-zero for failure. The value ENOENT (see errno.h) indicates that a key or value passed as an argu-
ment does not exist in the cache. EINVAL is used for invalid arguments.
EXAMPLE
The following example attempts to fetch a value from a cache using a key. If the value is not present in the cache then it is created and
added to the cache. The value is then used and released back to the cache to allow the cache to evict it when needed.
cache_t *mycache;
cache_create("com.mycompany.mycache", &cache_attributes, &mycache);
void *mykey = my_create_key();
void *myvalue = NULL;
if (cache_get_and_retain(mycache, mykey, &myvalue) != 0) {
myvalue = my_create_value_from_key(mykey);
cache_set_and_retain(mycache, mykey, myvalue, 0);
}
my_use_value(value);
cache_release_value(mycache, myvalue);
SEE ALSO cache(3)Darwin May 7, 2009 Darwin