freebsd-dev/contrib/awk/awklib/eg/lib/join.awk
2000-08-15 10:02:07 +00:00

16 lines
373 B
Awk

# join.awk --- join an array into a string
# Arnold Robbins, arnold@gnu.org, Public Domain
# May 1993
function join(array, start, end, sep, result, i)
{
if (sep == "")
sep = " "
else if (sep == SUBSEP) # magic value
sep = ""
result = array[start]
for (i = start + 1; i <= end; i++)
result = result sep array[i]
return result
}