![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
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 |
| Is there a awk solution for this?? | timj123 | Shell Programming and Scripting | 7 | 03-14-2008 06:28 AM |
| Is There a Sed Solution for This? | racbern | Shell Programming and Scripting | 1 | 03-13-2008 11:31 AM |
| Sun and backup solution | Jshwon | SUN Solaris | 1 | 10-23-2007 12:54 PM |
| Suexec solution | the_last_rites | UNIX for Dummies Questions & Answers | 13 | 01-18-2005 08:14 AM |
| Need an urgent solution | myelvis | UNIX for Dummies Questions & Answers | 1 | 11-21-2003 10:50 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
Grep solution
I have a file arg_file
a1, b1, c1... a2, b2, c2... a3, b3, c3... a4, b4, c4... a5, b5, c5... a6, b6, c6... a7, b7, c7... a8, b8, c8... a9, b9, c9... I have another file pat_file a2 a5 a9 I want to create an output file which does not contains the values found pat_file : a1, b1, c1... a3, b3, c3... a4, b4, c4... a6, b6, c6... a7, b7, c7... a8, b8, c8... Currently I am using `grep -v -f pat_file arg_file > outputfile`. But this is taking very long to process ..is there an efficient soultion to this. My files may contain peak time approx. 90K records too. Thanks Amruta |
|
||||
|
how about this
Code:
awk -F, 'NR==FNR{arr[$1]=$0} NR!=FNR{arr[$1]=""} END{for(i in arr) if(arr[i]!="") print arr[i]} filename1 filename2
filename1 --> file with all the data (arg_file)
filename2 --> file with columns that needs to be removed (pat_file)
|
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|