Venn diagram results using awk


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Venn diagram results using awk
# 8  
Old 07-23-2012
try this:

Code:
 join -v1 -v2  1.txt 2.txt


Last edited by RudiC; 07-23-2012 at 01:54 PM.. Reason: corrected file names
This User Gave Thanks to RudiC For This Post:
# 9  
Old 07-23-2012
Quote:
Originally Posted by RudiC
try this:

Code:
 join -v1 -v2  1.txt 2.txt

Since there were 2 columns, we used -v1 and -v2. If there were three should we add -v3?

am I missing the logic?

Could you please explain the logic?

It worked. Thanks
# 10  
Old 07-23-2012
I really have to ask: what does the "Venn" in the subject "Venn results using awk" mean?
# 11  
Old 07-23-2012
Quote:
Originally Posted by Scott
I really have to ask: what does the "Venn" in the subject "Venn results using awk" mean?
I was talking about Venn Diagram outputs.

Usually, in a venn diagram u can interpret how many records fall into how many categories in a pictorial fashion.

There is this program called genevenn that runs on Java to do this task. But it takes only 1 column. You can try it. Just do it with alphabets. You dont have to give it gene names.

Just go to google and say genevenn.

HTH
# 12  
Old 07-23-2012
Thanks. I've updated the subject to include "diagram". I'm sure if I googled for "venn results using awk" I'd have found your thread, mostly thanks to our good page rank. But to the uninitiated it looked like a typo Smilie
This User Gave Thanks to Scott For This Post:
# 13  
Old 07-24-2012
Quote:
Originally Posted by jacobs.smith
Since there were 2 columns, we used -v1 and -v2. If there were three should we add -v3?

am I missing the logic?
We're not talking columns (=fields) but files. As max 2 files can be joined, -v1 prints unpaired lines from FILE1, -v2 same for FILE2, -v3 does not exist. The error message
Code:
join -v1 -v2 -v3 y.txt x.txt
join: invalid field number: `3'

is somewhat misleading.
# 14  
Old 07-24-2012
In awk, NR tells you the overall record number and FNR tells you the record number of the current file. Also the variable FILENAME gives you the name of the current file.

In the BEGIN pattern, have a variable called PREV_FILENAME

So
Quote:
(a) If NR==FNR, then it is the first file (array[1] say).
(b) If NR <> FNR and PREV_FILENAME is empty, then it is the second file array[2]. Also assign FILENAME to PREV_FILENAME
(c) If NR <> FNR and PREV_FILENAME <> FILENAME, then it is the third file (array[3]) and so on
OK

Theoretically, we dont even need NR, FNR check and can do it for as many files as we need.

On END pattern, vomit out the result.

If an array element is empty, then it is empty (contra case).

OK

Last edited by ananthap; 07-24-2012 at 08:57 AM..
Login or Register to Ask a Question

Previous Thread | Next Thread

8 More Discussions You Might Find Interesting

1. Emergency UNIX and Linux Support

Venn Data Maker

Hi, My input is like this head input.txt Set1,Set2,Set3 g1,g2,g3 g2,g1,g3, g4,g5,g5 g1,g1,g1, g2,g1,g1, g6,g7,g8 ,g7,g8 ,,g8 My output file should be Name,Set1,Set2,Set3 g1,1,1,1 (18 Replies)
Discussion started by: jacobs.smith
18 Replies

2. Shell Programming and Scripting

Substitute from awk results

Hi, The following awk command : asmcmd lsdg | awk '{print $13;}' | grep -i ${SID} return the following output . An Empty line + two lines contain "/" at the end of the line INDEVDATA/ INDEVFRA/ I need to remove the "/" as well as the empty line. Please advise Thanks (3 Replies)
Discussion started by: Yoav
3 Replies

3. Hardware

hardware diagram / database

Hi - we are looking for a (hopefully free/opensource) solution for diagramming our rack/hardware configuration. the rack solution seems easier to find than the hardware piece. i.e. on our IBM 770 with two CEC's, a method of noting what hardware points to what... for example, on the primary CEC,... (0 Replies)
Discussion started by: TinWalrus
0 Replies

4. Shell Programming and Scripting

Loop through awk results

I have files structured in stanzas, whose title is '', and the rest couples of 'id: value'. I need to find text within the title and return the whole stanzas that match the title. The following works: awk 'BEGIN{RS="";IGNORECASE=1}/^\/' myfileI would need to count all of the occurences, though,... (7 Replies)
Discussion started by: hermes14
7 Replies

5. Shell Programming and Scripting

Output of AWK Results

In the following line The AWK statement parses through a listing for files and outputs the results using the {print} command to the screen. Is there a way to (a) send the output to a file and (b) actually perform a cp cmd to copy the listed files to another directory? ls | awk -va=$a -vb=$b... (1 Reply)
Discussion started by: rdburg
1 Replies

6. Shell Programming and Scripting

need a little help with results from awk

Hi there all, I am using a line to get some replys from my PS I do ps -ef |awk '{printf $9}' But my result is 1 big line. No spaces between the lines or someting for example:... (2 Replies)
Discussion started by: draco
2 Replies

7. Shell Programming and Scripting

Wierd results with awk

Hey, I'm trying to use awk for some simple file manipulations but i'm getting soem wierd results. So i want to open up a file which looks like this: @relation 'autoMpg' @attribute a numeric @attribute b numeric @attribute c numeric @data -1.170815,0.257522,0.016416... (2 Replies)
Discussion started by: amatheny
2 Replies

8. UNIX for Advanced & Expert Users

Process diagram for 50+ unix scripts

Can someone point me to a good book for drawing a process diagram for 50+ unix scripts? The scripts run at different frequencies, and do everything from putting and getting data via FTP, to database I/O, to checking disk space ... etc. (0 Replies)
Discussion started by: tomstone_98
0 Replies
Login or Register to Ask a Question