![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Rules & FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts here. |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Comparing two files | superstar003 | Shell Programming and Scripting | 2 | 05-08-2008 01:36 AM |
| Comparing files | soliberus | Shell Programming and Scripting | 5 | 04-28-2008 11:37 PM |
| Comparing two files... | paqman | Shell Programming and Scripting | 12 | 08-08-2007 12:45 AM |
| Problem comparing 2 files with lot of data | rafisha | Shell Programming and Scripting | 4 | 07-25-2007 04:56 PM |
| comparing shadow files with real files | terrym | UNIX for Advanced & Expert Users | 4 | 02-08-2007 10:38 PM |
|
|
LinkBack | Thread Tools | Display Modes |
| Forum Sponsor | ||
|
|
|
||||
|
fgrep Not worked for my problem
I gave you the sample of files. But in reality, both files are having 10 millions of records. When I tried your solution using fgrep, got the below error message:
fgrep: could not allocate memory for wordlist Are there any other solutions please... |
|
||||
|
Hm,
if the number of columns in the first csv is fixed, you could try Awk: Code:
awk -F, 'NR == FNR {
_[$0]
next
}
!(($1 FS $2 FS $3 FS $4) in _)
' file1.csv file2.csv
Or, something like this, will not be fast Code:
awk -F, 'BEGIN {
f = ARGV[1]
ARGV[1] = ""
}
{
while ((getline _f < f) > 0)
if (($1 FS $2 FS $3 FS $4) == _f)
next
close(f)
}
1' file1.csv file2.csv
Last edited by radoulov; 06-12-2008 at 05:27 AM. |
||||
| Google UNIX.COM |