Path: utzoo!attcan!uunet!husc6!mailrus!cornell!rochester!kodak!ektools!mcapron From: mcapron@ektools.UUCP (M. Capron) Newsgroups: comp.unix.wizards Subject: This is strange... Keywords: sed awk pipe Message-ID: <1652@ektools.UUCP> Date: 22 Dec 88 16:19:24 GMT Organization: Eastman Kodak, Dept. 47, Rochester N.Y. Lines: 29 Here is some bizareness I found. Below is a subset of a Bourne Shell script I am writing on a Sun 3/60 running SunOS 4.0. This segment generates dependency lists for makefiles. Note that the egrep brackets should contain a space and a tab. #!/bin/sh for i in *.c do #Place a list of include files in $incs seperated by spaces. #CODE A or CODE B goes here. echo "$i : $incs" done CODE A: This works. incs=`egrep '^#[ ]*include[ ]*"' $i | awk '{printf "%s ", $2}'` incs=`echo "$incs" | sed 's/"//g'` CODE B: This does not work. incs=`egrep '^#[ ]*include[ ]*"' $i | awk '{printf "%s ", $2}' | sed 's/"//g'` With CODE B, $incs comes out to be nil. I can't figure out what the difference is, nor do I have the patience to play with it any furthing. I present it as an oddity to any interested parties. Sincerely, Mike Capron capron@chiron.UUCP