Sorry, my description of the new requirement was poorly explained. The new objective it to get the consumer/service pair with the lowest time value ($4) and associated token ($3).
I have the correct result however I have done so via accidentally introducing a typo. Is someone able to explain...
If there was a further field with a token value, is there an easy method to retrieve the entire line? I am interested in the token associated with the consumer/service pair with the smallest time value. For brevity, I have supplied a subset of data.
$1 consumer
$2 service
$3 token value
$4...
Many thanks for your assistance Mikrom. Great approach to the problem.
$ cat get_min_time.awk
BEGIN { FS="," }
{
key=sprintf("%s_%s", $1, $2)
if(!min_time_value[key]) {
min_time_value[key] = $3
}
if(min_time_value[key] > $3) {...
Hello All,
I have a file with three fields delimited by a comma:
field1 is a consumer name
field2 is the service used by a given consumer
filed3 is a time value
I would like to display the line for each consumer/service pair with the earlier time i.e. smallest time value
Sample input file:
$...
Thank you @mikrom. You are quite right. I should have provided more background and context to this task. This task is the final part of a larger piece of work.
The 'factorPotency' list has already been pre-sorted by a routine by the second data-pair item (the numeric). The final outstanding...
Hello,
I got the required result via the below routine. I am intrigued by the suggested dictionary approach. If someone could attempt the dictionary method I would be grateful to further my learning.
@xwb thanks for your response.
factorPotency = [('chain', 100), ('compound', 100)...
Greetings,
I have a series of lab label/factor pairs in a list of tuples. I need to work through the factorPotency list retaining the label/factor pairs with the highest factor value in the event of duplicate label names e.g. 'chain'.
Could someone assist with this query?
factorPotency =...
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.