File: join.awk

package info (click to toggle)
gawk 1%3A3.0.4-4
  • links: PTS
  • area: main
  • in suites: potato
  • size: 4,972 kB
  • ctags: 2,679
  • sloc: ansic: 25,477; awk: 2,527; sh: 2,351; yacc: 2,096; makefile: 965
file content (15 lines) | stat: -rw-r--r-- 373 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
# 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
}