10-04-2012
awk program to join 2 fields of different files
Hello Friends,
I just need a small help, I need an awk program which can join 2 fields of different files which are having one common field into one file.
File - 1
FileName~Size
File- 2
FileName~Date
I need the output file in the following way
O/P- File
FileName~Date~Size
For this req, do the files have to be sorted?,
The files are as huge as 10 million lines.
Need your help,
Thanks in Advance
Regards,
Abhishek S.
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
nawk 'NR==FNR{a;next} {if($1 in a) print $1,"Found" else print}' OFS="," File_B File_A
The above code is not working help is appreciated (6 Replies)
Discussion started by: pinnacle
6 Replies
2. UNIX for Dummies Questions & Answers
Hello,
My apologies if this has been posted elsewhere, I have had a look at several threads but I am still confused how to use these functions. I have two files, each with 5 columns:
File A: (tab-delimited)
PDB CHAIN Start End Fragment
1avq A 171 176 awyfan
1avq A 172 177 wyfany
1c7k A 2 7... (3 Replies)
Discussion started by: InfoSeeker
3 Replies
3. Shell Programming and Scripting
Hi, Unix Gurus,
I need to compare two file based on key value and load result to different files.
requirement as following:
file1
1, abc
2, bcd
4, cdefile2
1, aaaaa
2, bbbbb
5, ccccckey value is first column for both file.
I need generate following files;
records_in_1_not_2.txt
4,... (6 Replies)
Discussion started by: ken002
6 Replies
4. Shell Programming and Scripting
Is it possible to join all the files with input1 based on 1st column?
input1
a
b
c
d
e
f
input2
a
b
input3
a
e
input4
c (2 Replies)
Discussion started by: quincyjones
2 Replies
5. Shell Programming and Scripting
I have two files,
file1.txt:
1 abc
2 def
2 dgh
3 ijk
4 lmn
file2.txt
1 opq
2 rst
3 uvw
My desired output is:
1 abc opq
2 def rst
2 dgh rst
3 ijk uvw (2 Replies)
Discussion started by: xan.amini
2 Replies
6. Shell Programming and Scripting
Hi All,
I am looking for an awk script to do the following
Join the fields together only if the first 4 fields are same.
Can it be done with join function in awk??
a,b,c,d,8,,,
a,b,c,d,,7,,
a,b,c,d,,,9,
a,b,p,e,8,,,
a.b,p,e,,9,,
a,b,p,z,,,,9
a,b,p,z,,8,,
desired output:
... (1 Reply)
Discussion started by: aksijain
1 Replies
7. Shell Programming and Scripting
Hello All,
file1
A1;B1;C1;D1;E1;F1;G1;H1;III1;J1
A2;B2;C2;D2;E2;F2;G2;H2;III2;J2
A3;B3;C3;D3;E3;F3;G3;H3;III3;J3
A4;B4;C4;D4;E4;F4;G4;H4;III4;J4file2
III1 ZZ1 S1 Y 1 P1 None NA
III2 ZZ2 S2 Y 3 P2 None NA
III3 ZZ3 S2 Y 5 ... (2 Replies)
Discussion started by: vikus
2 Replies
8. Shell Programming and Scripting
Hello all,
I want to join 2 tabbed files on the first 2 fields, and filling the missing values with 0. The 3rd column in each file is constant for the entire file.
file1
12658699 ST5 XX2720 0 1 0 1
53039541 ST5 XX2720 1 0 1.5 1
file2 ... (6 Replies)
Discussion started by: sheetalk
6 Replies
9. Shell Programming and Scripting
Hello All;
I have two files:
File1:
abc
def
pqr
File2:
abc,123
mno,456
def,989
pqr,787
ghj,678 (6 Replies)
Discussion started by: mystition
6 Replies
10. Shell Programming and Scripting
Hello,
This post is already here but want to do this with another way
Merge multiples files with multiples duplicates keys by filling "NULL" the void columns for anothers joinning files
file1.csv:
1|abc
1|def
2|ghi
2|jkl
3|mno
3|pqr
file2.csv:
1|123|jojo
1|NULL|bibi... (2 Replies)
Discussion started by: yjacknewton
2 Replies
epp(3erl) Erlang Module Definition epp(3erl)
NAME
epp - An Erlang Code Preprocessor
DESCRIPTION
The Erlang code preprocessor includes functions which are used by compile to preprocess macros and include files before the actual parsing
takes place.
EXPORTS
open(FileName, IncludePath) -> {ok,Epp} | {error, ErrorDescriptor}
open(FileName, IncludePath, PredefMacros) -> {ok,Epp} | {error, ErrorDescriptor}
Types FileName = atom() | string()
IncludePath = [DirectoryName]
DirectoryName = atom() | string()
PredefMacros = [{atom(),term()}]
Epp = pid() -- handle to the epp server
ErrorDescriptor = term()
Opens a file for preprocessing.
close(Epp) -> ok
Types Epp = pid() -- handle to the epp server
Closes the preprocessing of a file.
parse_erl_form(Epp) -> {ok, AbsForm} | {eof, Line} | {error, ErrorInfo}
Types Epp = pid()
AbsForm = term()
Line = integer()
ErrorInfo = see separate description below.
Returns the next Erlang form from the opened Erlang source file. The tuple {eof, Line} is returned at end-of-file. The first form
corresponds to an implicit attribute -file(File,1). , where File is the name of the file.
parse_file(FileName,IncludePath,PredefMacro) -> {ok,[Form]} | {error,OpenError}
Types FileName = atom() | string()
IncludePath = [DirectoryName]
DirectoryName = atom() | string()
PredefMacros = [{atom(),term()}]
Form = term() -- same as returned by erl_parse:parse_form
Preprocesses and parses an Erlang source file. Note that the tuple {eof, Line} returned at end-of-file is included as a "form".
ERROR INFORMATION
The ErrorInfo mentioned above is the standard ErrorInfo structure which is returned from all IO modules. It has the following format:
{ErrorLine, Module, ErrorDescriptor}
A string which describes the error is obtained with the following call:
Module:format_error(ErrorDescriptor)
SEE ALSO
erl_parse(3erl)
Ericsson AB stdlib 1.17.3 epp(3erl)