Sponsored Content
Top Forums Shell Programming and Scripting Merging two files with condition Post 302542312 by rdcwayx on Wednesday 27th of July 2011 07:52:36 AM
Old 07-27-2011
Code:
awk '{a[$1 FS $2]+=$3; b[$1 FS $2]++}END {for (i in a) print i, a[i]/b[i]|"sort -n"}' file1 file2

 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Merging two files

Hi I have a requirement like this. I have two files This is how data1.txt looks: EI3171280 38640658501 NENN2005-12-129999-12-312005-12-12HALL NANCY 344 CHENEY HIGHWAY ... (4 Replies)
Discussion started by: venommaker
4 Replies

2. Shell Programming and Scripting

merging files

Thanks in advance I have 2 files having key field in each.I would like to join both on common key.I have used join but not sucessful. The files are attached here . what i Want in the output is on the key field SLS OFFR . I have used join commd but not successful. File one ======= SNO ... (6 Replies)
Discussion started by: vakharia Mahesh
6 Replies

3. Shell Programming and Scripting

Help with merging files

i would like to merge two files that have the same format but have different data. i would like to create one output file that contains information from both the original files.:rolleyes: (2 Replies)
Discussion started by: joe black
2 Replies

4. Shell Programming and Scripting

merging of files.

Hi, I want to merge the two files on the basis of columns like... file 1 Data Key A 12 B 13 file2 Data Value A A1 A A2 B B1 B B2 (5 Replies)
Discussion started by: clx
5 Replies

5. Shell Programming and Scripting

Merging of all files based on a condition

Hi Friends, I am new to UNIX. I need to merge all the files(to FINAL.txt) in single directory based one condition. Out of all the files one of file will have specific value like :GF01: at any where in the file. so the file which is having :GF01: should be appended at the last. EX:... (5 Replies)
Discussion started by: arund_01
5 Replies

6. Shell Programming and Scripting

Merging two files with same name

Hello all, I have limited experience in shell scripting. Here goes my question: I have two directories that have same number of files with same file names i.e. consider 2 directories A and B. Both directories have files 1.txt, 2.txt...... I need to merge the file 1.txt of A with file 1.txt... (5 Replies)
Discussion started by: jaysean
5 Replies

7. Shell Programming and Scripting

merging two files

file1.txt 1 2 10 11 56 57 7 8 43 44 and let's suppose that there is a file called file2.txt with 100 columns I want to produce a file3.txt with columns specified in file1.txt in that order (1,2,10,11,56,57,7,8,43,44) Thanks! (2 Replies)
Discussion started by: johnkim0806
2 Replies

8. Shell Programming and Scripting

Merging two files

Guys, I am having little problem with getting a daily report! The daily process that I do is as follows 1. Unload Header for the report from the systables to one unl file, say Header.unl 2. Unload the data from the required table/tables to another unl file, say Data.unl 3. Send a... (2 Replies)
Discussion started by: PikK45
2 Replies

9. UNIX for Dummies Questions & Answers

Merging two files baased on condition

Hi All, I have two below files(fileds separated by space). File1 001078401 A 5A1 001078401 B 085 001030035 A 5A1 001030035 B 085 File2 001078401 C 001 001078401 D 065 001030035 C 001 001030035 D 065... (6 Replies)
Discussion started by: satyar
6 Replies

10. Shell Programming and Scripting

Merging two files

Hi All , I have a scenario where we need to combine two files . Below are the sample files and expected output , File 1: 1|ab 1|ac 1|ae 2|ad 2|ac File 2: 1|xy 1|fc 2|gh 2|ku Output file : 1|ab|xy (3 Replies)
Discussion started by: saj
3 Replies
ISUPPER(3)						   BSD Library Functions Manual 						ISUPPER(3)

NAME
isupper -- upper-case character test LIBRARY
Standard C Library (libc, -lc) SYNOPSIS
#include <ctype.h> int isupper(int c); DESCRIPTION
The isupper() function tests for any upper-case letter. The value of the argument must be representable as an unsigned char or the value of EOF. In the ASCII character set, this includes the following characters (with their numeric values shown in octal): 101 ``A'' 102 ``B'' 103 ``C'' 104 ``D'' 105 ``E'' 106 ``F'' 107 ``G'' 110 ``H'' 111 ``I'' 112 ``J'' 113 ``K'' 114 ``L'' 115 ``M'' 116 ``N'' 117 ``O'' 120 ``P'' 121 ``Q'' 122 ``R'' 123 ``S'' 124 ``T'' 125 ``U'' 126 ``V'' 127 ``W'' 130 ``X'' 131 ``Y'' 132 ``Z'' RETURN VALUES
The isupper() function returns zero if the character tests false and returns non-zero if the character tests true. COMPATIBILITY
The 4.4BSD extension of accepting arguments outside of the range of the unsigned char type in locales with large character sets is considered obsolete and may not be supported in future releases. The iswupper() function should be used instead. SEE ALSO
ctype(3), iswupper(3), toupper(3), ascii(7) STANDARDS
The isupper() function conforms to ISO/IEC 9899:1990 (``ISO C90''). BSD
July 17, 2005 BSD
All times are GMT -4. The time now is 03:35 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy