From mboxrd@z Thu Jan 1 00:00:00 1970 From: David Shepherd Subject: Field splitting in backquote substitutions (fwd) To: rc@archone.tamu.edu Date: Fri, 28 Jun 1991 12:10:13 -0500 X-Mailer: ELM [version 2.3 PL11] Message-ID: <19910628171013.A4qGhmjWC5_na0PnO9YvWHu5oUPrDlBiYlIRTIT26lc@z> Mark-Jason Dominus has said: > The field splitting rule in rc is very consistent. If $ifs is > (' ' '\t' '\n'), then any space, tab, or newline starts a new field. > > This means that if you do someting like > > for (i in `{echo 'foo to you'} ) > echo $i > > you get > > foo > > to > > > you > > which is probably not what you wanted, and maybe not what you expected > either since the csh and sh backquotes would have yielded > > foo > to > you > > instead. > > In awk, FS can be an arbitrary regular expression, and any string > which matches FS is taken as a field separator. But there's a special > case: if FS is a single blank, then it really means that any sequence of > spaces, tabs, and/or newlines constitute a field separator. isn't the behaviour that you (and probably i) expect exactly what strtok gives you ... ie strtok(str,seps) considers str to consist of a list of tokens seperated by one *or more* characters from sep. if this splitting is implemented by strtok then it would be "intuitively correct". -------------------------------------------------------------------------- david shepherd: des@inmos.co.uk or des@inmos.com tel: 0454-616616 x 379 inmos ltd, 1000 aztec west, almondsbury, bristol, bs12 4sq "pugh, pugh, barney mcgrew, cuthbert, dibble, grubb !"