Sponsored Content
Top Forums Shell Programming and Scripting awk help: Match data fields from 2 files & output results from both into 1 file Post 302742645 by Corona688 on Tuesday 11th of December 2012 11:33:24 AM
Old 12-11-2012
There's really no substitute for just using it until you're used to it.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

AWK Compare files, different fields, output

Hi All, Looking for a quick AWK script to output some differences between two files. FILE1 device1 1.1.1.1 PINGS device1 2.2.2.2 PINGS FILE2 2862 SITE1 device1-prod 1.1.1.1 icmp - 0 ... (4 Replies)
Discussion started by: stacky69
4 Replies

2. Shell Programming and Scripting

[Shell/Perl(?)] Prepending timestamps to console output & writing results to a file

I do a lot of TSM work and I embarked on what I thought would be an easy task, and I'd be very happy for any input to save the pounding my keyboard is receiving :] By default, the output of TSM's console has no timestamping, making it hard to sort through accurately. This puts my console into... (5 Replies)
Discussion started by: Vryali
5 Replies

3. Shell Programming and Scripting

AWK to match and merge data from 2 files into 1.

Hello, hopefully this is an easy on for the AWK guru's out there. I'm having some trouble figuring out how to match+merge data in 2 files into 1 single report. I've got my 2 files filtered and delimited, just need to MATCH $3 in file1 to $1 in file2, then put $0 from File1 and $2+$3 from File2... (6 Replies)
Discussion started by: right_coaster
6 Replies

4. Shell Programming and Scripting

awk to output match and mismatch with count using specific fields

In the below awk I am trying output to one file those lines that match between $2,$3,$4 of file1 and file2 with the count in (). I am also trying to output those lines that are missing between $2,$3,$4 of file1 and file2 with the count of in () each. Both input files are tab-delimited, but the... (7 Replies)
Discussion started by: cmccabe
7 Replies

5. Shell Programming and Scripting

awk to print fields that match using conditions and a default value for non-matching in two files

Trying to use awk to match the contents of each line in file1 with $5 in file2. Both files are tab-delimited and there may be a space or special character in the name being matched in file2, for example in file1 the name is BRCA1 but in file2 the name is BRCA 1 or in file1 name is BCR but in file2... (6 Replies)
Discussion started by: cmccabe
6 Replies

6. Shell Programming and Scripting

awk to print match or non-match and select fields/patterns for non-matches

In the awk below I am trying to output those lines that Match between file1 and file2, those Missing in file1, and those missing in file2. Using each $1,$2,$4,$5 value as a key to match on, that is if those 4 fields are found in both files the match, but if those 4 fields are not found then missing... (0 Replies)
Discussion started by: cmccabe
0 Replies

7. UNIX for Beginners Questions & Answers

Match Fields between two files, print portions of each file together when matched in ([g]awk)'

I've written an awk script to compare two fields in two different files and then print portions of each file on the same line when matched. It works reasonably well, but every now and again, I notice some errors and cannot seem to figure out what the issue may be and am turning to you for help. ... (2 Replies)
Discussion started by: jvoot
2 Replies

8. Shell Programming and Scripting

awk move select fields to match file prefix in two directories

In the awk below I am trying to use the file1 as a match to file2. In file2 the contents of $5,&6,and $7 (always tab-delimited) and are copied to the output under the header Quality metrics. The below executes but the output is empty. I have added comments to help and show my thinking. Thank you... (0 Replies)
Discussion started by: cmccabe
0 Replies

9. Shell Programming and Scripting

awk to update file based on match in 3 fields

Trying to use awk to store the value of $5 in file1 in array x. That array x is then used to search $4 of file1 to find aa match (I use x to skip the header in file1). Since $4 can have multiple strings in it seperated by a , (comma), I split them and iterate througn each split looking for a match.... (2 Replies)
Discussion started by: cmccabe
2 Replies

10. UNIX for Beginners Questions & Answers

awk match two fields in two files

Hi, I have two TEST files t.xyz and a.xyz which have three columns each. a.xyz have more rows than t.xyz. I will like to output rows at which $1 and $2 of t.xyz match $1 and $2 of a.xyz. Total number of output rows should be equal to that of t.xyz. It works fine, but when I apply it to large... (6 Replies)
Discussion started by: geomarine
6 Replies
COLLDEF(1)						    BSD General Commands Manual 						COLLDEF(1)

NAME
colldef -- convert collation sequence source definition SYNOPSIS
colldef [-I map_dir] [-o out_file] [filename] DESCRIPTION
The colldef utility converts a collation sequence source definition into a format usable by the strxfrm() and strcoll() functions. It is used to define the many ways in which strings can be ordered and collated. strxfrm() transforms its first argument and places the result in its second argument. The transformed string is such that it can be correctly ordered with other transformed strings by using strcmp(), strncmp(), or memcmp(). strcoll() transforms its arguments and does a comparison. The colldef utility reads the collation sequence source definition from the standard input and stores the converted definition in filename. The output file produced contains the database with collating sequence information in a form usable by system commands and routines. Options list: -I map_dir This option set directory name where charmap files can be found, current directory by default. -o out_file This option set output file name, LC_COLLATE by default. The collation sequence definition specifies a set of collating elements and the rules defining how strings containing these should be ordered. This is most useful for different language definitions. The specification file can consist of three statements: charmap, substitute and order. Of these, only the order statement is required. When charmap or substitute is supplied, these statements must be ordered as above. Any statements after the order statement are ignored. Lines in the specification file beginning with a # are treated as comments and are ignored. Blank lines are also ignored. charmap charmapfile charmap defines where a mapping of the character and collating element symbols to the actual character encoding can be found. The format of charmapfile is shown below. Symbol names are separated from their values by TAB or SPACE characters. symbol-value can be spec- ified in a hexadecimal (x??) or octal (???) representation, and can be only one character in length. symbol-name1 symbol-value1 symbol-name2 symbol-value2 ... The charmap statement is optional. substitute symbol with "repl_string" The substitute statement substitutes the character symbol with the string repl_string. Symbol names cannot be specified in repl_string field. The substitute statement is optional. order order_list order_list is a list of symbols, separated by semi colons, that defines the collating sequence. The special symbol ... specifies, in a short-hand form, symbols that are sequential in machine code order. An order list element can be represented in any one of the following ways: o The symbol itself (for example, a for the lower-case letter a) o The symbol in octal representation (for example, 141 for the letter a) o The symbol in hexadecimal representation (for example, x61 for the letter a) o The symbol name as defined in the charmap file (for example, <letterA> for letterA 23 record in charmapfile). If character map name have > character, it must be escaped as />, single / must be escaped as //. o Symbols a, , f, , , v are permitted in its usual C-language meaning o The symbol chain (for example: abc, <letterA><letterB>c, xf1bxf2) o The symbol range (for example, a;...;z) o Comma-separated symbols, ranges and chains enclosed in parenthesis (for example ( sym1, sym2, ... )) are assigned the same primary order- ing but different secondary ordering. o Comma-separated symbols, ranges and chains enclosed in curly brackets (for example { sym1, sym2, ... }) are assigned the same primary ordering only. The backslash character is used for continuation. In this case, no characters are permitted after the backslash character. DIAGNOSTICS
The colldef utility exits with the following values: 0 No errors were found and the output was successfully created. !=0 Errors were found. FILES
/usr/share/locale/<language>/LC_COLLATE standard shared location for collation orders under the locale locale SEE ALSO
mklocale(1), setlocale(3), strcoll(3), strxfrm(3) BSD
January 27, 1995 BSD
All times are GMT -4. The time now is 08:59 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy