Quote:
Originally Posted by
sigh2010
alex
you did not give alternative solution to the code.
Do you have one?
What's wrong with
yazu solution?! -(to your second part of your replay!)
(To your first statement: )
Actualy, you did not sound like you are looking for final line of code to do your job: that I most likely would not even start to responde!
I (seems wrongly) guess that you are looking for understanding how to go your stuff and for that bring up your work on (seems to you) simular piece of code.
I was trying to help you in that (in understanding).
To do your stuff after all explanation you should not have any problem, IMHO.
Speaking about the task: The answer is reflection of the question. In other words: 50% of an answer is a good question and in the question!
You did not ask enough clear to have a reasonable answer.
By discution I see that the delimiter in your file is the '~'.
Do you have any other restictionons?
Maybe files are big to be a problem to have the 1-st+6-th column be kept in memory (that I could see as a possible problem in
yazu's solution).. maybe something else?
Alright, assume both file are delimitered by the same '~' delimiter.
Assume by 'comparing column 1 and column 6' means (as used later) file-2's '~'-delimitered columns 1 and 6 are not the same as any record's the same columns in the file-1.
Assume the 'do not match ' means (as, again, understand later) never been found in the file-1 in the same positions in any record simultaneosly.
On all these requirements the first 'yazu' solution completely fine: build a hash of (1-st + 6-th) columns of the first file and print the second file's record when the same combination (not by value, but the combination: 1-st + 6-th columns of the second file's record) hash member is not exist!
What the problem do you have with that solution?
Not clear? (Probably, already not, but) here are few words:
- Only on first (by the NR==FNR) file the hash 'a' is built (the '++' in not nessesary, just shortest to be sure that the such index hash member is any how referensed.)
- On the second file the check of the 'a' hash is in the condition of selection for an action that is not specified; so, default is used: print a full (current) record.
File's delimiter is defined as command line parameter by the -F option. That is done in single quotes; so the special meaning of the '~' is not processed by the shell.
What else?!
Perfect solution to the described by my assumptions' task!
Something is not good in assumptions? - Explain!
Something does not work? - show that; but, better think and try out by yourself. When you stuck - bring it here.
That way help would be helpfull!
Just to solve a task helps just to cheaters or liers, who pretends to know and has no any interest to the subject.
I do not believe anyone could be not agree with my statements!
That why I have no interest to help people who do not think on task, unable to present a question reasonably and do not care answers without complete and final solution of the task.
Good luck!
Quote:
Originally Posted by
sigh2010
The awk solution did not work wither
How it is not work?
Should it be 'nawk'?
Show some result of test!