Path: utzoo!attcan!uunet!cbmvax!ditto From: ditto@cbmvax.UUCP (Michael "Ford" Ditto) Newsgroups: comp.unix.wizards Subject: Re: This is strange... Summary: needs trailing newline Keywords: sed awk pipe Message-ID: <5570@cbmvax.UUCP> Date: 23 Dec 88 01:59:48 GMT References: <1652@ektools.UUCP> Reply-To: ditto@cbmvax.UUCP (Michael "Ford" Ditto) Organization: Commodore Technology, West Chester, PA Lines: 19 In article <1652@ektools.UUCP> mcapron@ektools.UUCP (M. Capron) writes: >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. echo outputs a newline after its arguments, while your awk program won't. sed only processes lines that are properly newline-terminated. -- -=] Ford [=- "The number of Unix installations (In Real Life: Mike Ditto) has grown to 10, with more expected." ford@kenobi.cts.com - The Unix Programmer's Manual, ...!sdcsvax!crash!elgar!ford 2nd Edition, June, 1972. ditto@cbmvax.commodore.com