Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 28 Apr 1997 22:29:53 -0700
From:      John-Mark Gurney <jmg@hydrogen.nike.efn.org>
To:        "Jin Guojun[ITG]" <jin@george.lbl.gov>
Cc:        fenner@parc.xerox.com, FreeBSD-gnats-submit@freebsd.org, bugs@freebsd.org
Subject:   Re: bin/3387: sh mis-interpret the file name / awk failure
Message-ID:  <19970428222953.46086@hydrogen.nike.efn.org>
In-Reply-To: <199704290448.VAA08913@george.lbl.gov>; from Jin Guojun[ITG] on Mon, Apr 28, 1997 at 09:48:46PM -0700
References:  <199704290448.VAA08913@george.lbl.gov>

next in thread | previous in thread | raw e-mail | index | archive | help
Jin Guojun[ITG] scribbled this message on Apr 28:
> } That's correct.  What's really going on is that "uname -v" outputs a
> } space at the end.
> } 
> } % echo ">>`uname -v`<<"
> } >>FreeBSD 2.2-RELEASE #0: Mon Mar 24 11:03:31 GMT 1997     root@sundae.parc.xero
> } x.com:/usr/src/sys/compile/SUNDAE <<
> } 
> } so if you split on slashes and get the last piece, it is indeed "SUNDAE ".
> } awk is performing as you ask it to.
> 
> Thanks for pointing it out. This tells that GNU awk is innocent.
> Then, the futher question is "Can we change uname to make no space at the end?"
> I am happy to fix it, but every one have to agree to do so. Comments?

well.. I just checked with Solaris' awk.. and it doesn't do it like
this...

echo "sdlfk/sdfkj " | awk -F/ "{printf $NF }"

so the real fix is stop uname for including that extra space... also..
it would fundamentally break awk...  with awk you expect to get
everything EXACTLY between the field seperator (except for in the special
case the man page mentions)...  there is no extra field seperator between
the end of text and the new line...  so the space is part of the field...

I personally would object to this modification the awk.. and hope that
this crazy idea doesn't every get into your mind again.. :)

what I wouldn't object to is another flag that strips that white space
from around the fields...

-- 
  John-Mark
  Cu Networking                             Modem/FAX: +1 541 683 6954

  Live in Peace, destroy Micro$oft, support free software, run FreeBSD



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?19970428222953.46086>