![]() |
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | 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 and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Awking!! Printing decimal output is struck | divzz | Shell Programming and Scripting | 4 | 05-28-2008 09:02 AM |
| Splitting huge XML Files into fixsized wellformed parts | Malapha | Shell Programming and Scripting | 0 | 03-17-2008 11:35 AM |
| grepping many values from same files | Sreejith_VK | Shell Programming and Scripting | 2 | 03-15-2008 08:41 AM |
| grepping lines out of files | mariner | UNIX for Advanced & Expert Users | 2 | 09-24-2004 09:12 AM |
| diff 2 files; output diff's to 3rd file | blt123 | Shell Programming and Scripting | 2 | 05-28-2002 12:29 PM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
I did put that in:
BEGIN{FS=OFS=","} { idx = $1 SUBSEP $2 SUBSEP $5 SUBSEP $6 } NR==FNR { fnew[ idx ] = $0; next } { if ( !(idx in fnew) ) $0 = $0 ORS fold[idx] } 1 Not sure ??? I don't know why but I am getting both lines of file2. Did this happen with you? It sure looks like it should work. very odd. |
|
||||
|
I've got a way:
---------- #!/bin/ksh file1="file1" file2="file2" nawk -F, 'BEGIN { while ((getline < "'$file1'") > 0) { file2_ar[$1] = $1; file2_ar[$2] = $2; file2_ar[$5] = $5; file2_ar[$6] = $6; } OFS=","; } { if (file2_ar[$1] && file2_ar[$2] && file2_ar[$5] && file2_ar[$6]); else print $0; } END{}' $file2 > OUT ----------- The other way wouldn't seem to work for me, it looked alot cleaner, but hey. Temp Man lives another day!.......thanks 4 help |
![]() |
| Bookmarks |
| Tags |
| awk, grep |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|