The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
Google UNIX.COM



View Single Post in UNIX Forums - Click on the Thread or Permalink to View Entire Thread -->
  #5 (permalink)  
Old 01-31-2008
Franklin52 Franklin52 is online now
Moderator
 

Join Date: Feb 2007
Posts: 2,475
The OP deleted his question, for clarity, this was the request:
Quote:
Output of his command "./new < numbers.txt ":

hi how are you
what are you doing
or am i sleeping
the zebra ate the lion
yes sir
a banana fell

File datafile.txt:

a
the
or

Desired output:

hi how are you
what are you doing
yes sir

Try this:

Code:
./new < numbers.txt | awk '
  BEGIN{while(getline < "datafile.txt" > 0 ) {
    arr[$1]=$1
  }
  close("datafile.txt")
}
!arr[$1]{print}
'
Regards

Last edited by Franklin52; 02-01-2008 at 12:46 AM..
Reply With Quote