* Field splitting in backquote substitutions (fwd)
@ 1991-06-28 17:10 David Shepherd
0 siblings, 0 replies; only message in thread
From: David Shepherd @ 1991-06-28 17:10 UTC (permalink / raw)
To: rc
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 !"
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~1991-06-28 17:10 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1991-06-28 17:10 Field splitting in backquote substitutions (fwd) David Shepherd
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).