awk script problem

April 3, 2009 at 14:04:57
Specs: linux
I am new to awk, can somone please correct the following script

awk -F "," 'BEGIN {
foreach ((getline < "file1.csv") > 0)
a[i]=1 --> assuming the first column in the row will be stored in a[]
foreach (a[i] in f1) {
if (a[i] == $5) continue
print a[i];
} file2.csv'

Here is what I want to do

File 1,2/2/23,a,b,ga,2/2/23,a,b,ga,2/2/12,a,b,c,2/2/23,a,b,ga

File 2

File 3,2/2/23,a,b,ga,2/2/23,a,b,ga

while reading in file1 it should compare in each row on file2 if found any where in the file2 it should be ignored while writing into output file.

See More: awk script problem

Report •

April 3, 2009 at 19:46:00
awk -F, 'FNR==NR{ _[$4]=$0;next}(!($1 in _))' file2 file1

Unix Win32 tools | Gawk for Windows

Report •

April 6, 2009 at 08:42:52
Both the files has different number of records. Sorry I could have told you first. File 1 has 80K and file2 has 2million records.

Report •

Related Solutions

Ask Question