Trying to join 2 files with awk (file1 has variable number of fields; file 2 has constant number of fields)
file1:
file2:
output:
What I tried so far:
The files join but only with 4 fields (it only takes $2 of file1):
Same problem with:
Do you have an idea how to join the 2 files without printing $1 of file 1 and with all the leading fields?
Is it possible to do this with awk command??
sort1.txt
a 10
b 20
sort2.txt
a
b
c
d
join command
join sort1.txt sort2.txt && join -v1 sort2.txt sort1.txt
output
a 10
b 20 (1 Reply)
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)
Hi -
I want to join 2 files on matching keys ( column 1 in both files ) and check for unmatched columns, If for each record print the first unmatched column from both files and then proceed to next record and do the same.
File 1:
123|Roy|jj|20/07/3000|25.48
125|Victor|kk|30/07/2009|34.56... (7 Replies)
Hi
I have many problems with a script. I have a script that formats a text file but always prints the same error when i try to execute it
The code is that:
{
if (NF==17){
print $0
}else{
fields=NF;
all=$0;
while... (2 Replies)
Is is possible to join on unsorted files by a string? Don't want to sort because there is other text that is already in a good format.
I want to replace or join RBOSK-374 in file 2 with NB2781 FGH in file 1.
Any help would be appreciated.
a.log: RBOSK-374 AAA-B04-D16-K01
a.log: 0 XXX 602... (1 Reply)
Hello Friends,
I'm trying something hard (for me) to create a report script,normally the following script works:
Echos are just for cosmetic touch,
echo -n "\n-----\t----------\t-------------\t\t--------------\t\t--------\n
COUNT\tEVENT_TYPE\tRESPONSE_CODE\t\tINTERNAL_ERROR\t\tFLOWNAME... (7 Replies)
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)