Sponsored Content
Top Forums UNIX for Dummies Questions & Answers Partially match and rank question Post 302918861 by Don Cragun on Thursday 25th of September 2014 09:56:43 PM
Old 09-25-2014
With your new input file format, the following seems to work:
Code:
awk '
FNR == NR {
        key[$1]
        next
}
{       for(k in key)
                if(index($2, k)) 
                        key[k] += $4
}
END {   for(k in key)
                printf("%s (%.1f)\n", k, key[k]) 
}' file2 file1 | sort -t'(' -k2,2n

This User Gave Thanks to Don Cragun For This Post:
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

grep question - match a url

I'm trying to find files which have urls such as "services/amf/fri/home.html" and "services/amj/fri/air.html" - so the pattern I want to match with grep, logically, is one that has 1. "services/" 2. stuff in between including slashes, numbers, underscores etc 3. ending in "html" Can... (5 Replies)
Discussion started by: pauljohn
5 Replies

2. Shell Programming and Scripting

How to partially replace variable value?

I have variable $2 whose value is expdp_SDW_MSTR_VMDB.par I want to replace three characters from right (par) with (log) Input --> expdp_SDW_MSTR_VMDB.par Output --> expdp_SDW_MSTR_VMDB.log Thanks Deep (2 Replies)
Discussion started by: deep.singh
2 Replies

3. Shell Programming and Scripting

pattern match question

I have a pattern match problem I could use your help with I have a file in the following format (names.txt) jae,doe john,doe jay,doe I need to loop through the file using FOR and check the names in names.txt against another file (information.txt). information.txt is in the following... (2 Replies)
Discussion started by: chaos40
2 Replies

4. Shell Programming and Scripting

Exact match question

Hi, I have a file like follows . . . White.Jack.is.going.home Black.Jack.is.going.home Red.Jack.is.going.home Jack.is.going.home . . . when I make: cat <file> | grep -w "Jack.is.going.home" it gives: White.Jack.is.going.home Black.Jack.is.going.home Red.Jack.is.going.home... (4 Replies)
Discussion started by: salih81
4 Replies

5. Shell Programming and Scripting

Is it possible to partially clear the terminal?

The clear command specifically says it can only clear the entire terminal display. There are no arguments. So I'm wondering if there are any work arounds. Carriage return does not work for this as it only moves the cursor to the beginning of the line we're on. And obviously NL only goes down. If... (1 Reply)
Discussion started by: FunkyLich
1 Replies

6. Web Development

Fix For Google Page Rank: Wordpress List Rank Dashboard Widget

Here is the fix for the recent Google changes to their pagerank API. For example, in the List Rank Dashboard Widget Wordpress Plugin (Version 1.7), in this plugin file: list-rank-dashboard-widget/wp-list-rank-class.php in this function: function getGooglePR($url) Change this line: ... (0 Replies)
Discussion started by: Neo
0 Replies

7. Shell Programming and Scripting

How to output the partially equals

Hello i have 2 files: a.out 10.1.1.1 james.franco 10.1.1.3 google.gol 10.1.1.14 yahoo.bol b.out 10.1.1.1 10.1.1.3 10.1.1.45 I need to see an output just with: 10.1.1.1 james.franco 10.1.1.3 google.gol Thankz in advance!! (2 Replies)
Discussion started by: danielldf
2 Replies

8. UNIX for Dummies Questions & Answers

Script partially executes??

Hi All, I am calling a shell script from another shell script, however, it only executes part of it (the echo commands only). What could be some causes for that? For example: ShellScriptA.sh: ... ... ... . ShellScriptB.sh ShellScriptB.sh contents: echo date echo... (7 Replies)
Discussion started by: DBnixUser
7 Replies

9. UNIX for Dummies Questions & Answers

Exact match question

Hi guys, I am using Centos 6.3. Actually I posted similar question but I still have some minor problem need be fixed. I have two files, file1:target: gi|57529786|ref|NM_001006513.1| mfe: -31.4 kcal/mol p-value: 0.006985 target: gi|403048743|ref|NM_001271159.1| mfe: -29.6 kcal/mol p-value:... (11 Replies)
Discussion started by: yuejian
11 Replies

10. UNIX for Dummies Questions & Answers

Match and rank question

I actually posted a similar question before but my expression probably lead the helper here frustrated. I also tried to figure it out by myself but failed. So I rephrase my question again and hopefully it is clearer to understand. I really appreciate your help. Here is the file1target:... (2 Replies)
Discussion started by: yuejian
2 Replies
KSTASH(8)						    BSD System Manager's Manual 						 KSTASH(8)

NAME
kstash -- store the KDC master password in a file SYNOPSIS
kstash [-e string | --enctype=string] [-k file | --key-file=file] [--convert-file] [--random-key] [--master-key-fd=fd] [--random-key] [-h | --help] [--version] DESCRIPTION
kstash reads the Kerberos master key and stores it in a file that will be used by the KDC. Supported options: -e string, --enctype=string the encryption type to use, defaults to DES3-CBC-SHA1. -k file, --key-file=file the name of the master key file. --convert-file don't ask for a new master key, just read an old master key file, and write it back in the new keyfile format. --random-key generate a random master key. --master-key-fd=fd filedescriptor to read passphrase from, if not specified the passphrase will be read from the terminal. FILES
/var/heimdal/m-key is the default keyfile if no other keyfile is specified. The format of a Heimdal master key is the same as a keytab, so ktutil list can be used to list the content of the file. SEE ALSO
kdc(8) BSD
April 10, 2007 BSD
All times are GMT -4. The time now is 11:34 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy