On Wed Jun 22 12:00:07 EDT 2011, [email protected] wrote:
> >ifs seems a holdover. it's only ever used in `{} yet
> >it's a global inherited variable. so it's easy to write
> >a script that assumes that ifs is set to the default.
>
> i wonder if it's best left alone. it isn't detailed enough
> to crack many plausible formats, for instance full csv.
> if i needed one of those formats to feed into a `{} i'd add
> a filter that converted to quoted & space-separated fields
> that the default ifs would crack.
yes. rc splitting is limiting, and i'd love a better idea.
my argument isn't that this is great, but that it is better.
like the type system in c. :-)
as a lame example, ...
the word splitting in `{} is good enough to handle many
formats, including splitting by naïve word and line.
at one point i rewrite iwhois to handle other
registrars than network solutions, and it was very handy
to have these functions
fn split{
ifs=. x=`{echo -n $*} echo $x
}
fn permute{
while(! ~ $#* 0){
echo $*|sed 's/ /./g'
shift
}
}
to walk through whois databases for names like x.y.example.com.au
to find the registered name without having a database of which database
operates at which level.
- erik