   awk help - conditionally merge 2 files
  I have a 3 column file that represents a symbol table for a certain program image, generated directly using nm on every build.0025e8dc T _IO_file_fopen0025e71c T _IO_file_init00352e1f T rtcTimeGetI have another static file that specifies a number to correspond with certain functions, like so:2 rtcTimeGetWhat I want to do is create a new file that combines this information, and substitutes a 1 for anything thats in the nm dump but not the static file, like so:1 0025e8dc T _IO_file_fopen1 0025e71c T _IO_file_init2 00352e1f T rtcTimeGetCan awk do this? I've used it before to organize data but I've never tried to merge two files - and I can't find any useful information online about how to go about this.   
  Try something like this:#! /usr/bin/awk -f!main {  syms[$2] = $1}main {  if (syms[$3]) {    print syms[$3] " " $0  } else {    print 1 " " $0  }}Run it like this:nm foo.o > dump./bar.awk syms main=1 dumpWhere "syms" contains the contents of the static file.[Edited by - kinetik_mjg on June 3, 2006 7:47:41 AM]