From:http://www.starlink.rl.ac.uk/star/docs/sc4.htx/node38.html
The awk function split(s,a,sep) splits a string s into an awk array a using the delimiter sep.
set time = 12:34:56
set hr = `echo $time | awk '{split($0,a,":" ); print a[1]}'` # = 12
set sec = `echo $time | awk '{split($0,a,":" ); print a[3]}'` # = 56
set hr = `echo $time | awk '{split($0,a,":" ); print a[1]}'` # = 12
set sec = `echo $time | awk '{split($0,a,":" ); print a[3]}'` # = 56
# = 12 34 56
set hms = `echo $time | awk '{split($0,a,":" ); print a[1], a[2], a[3]}'`
set hms = `echo $time | awk '{split($0,a,":" ); for (i=1; i<=3; i++) print a[i]}'`
The last two statements are equivalent, but the latter is more convenient for longer arrays as you specify the start index and number of elements to print. Variable hms is also an array so hms[2] is 34.
C-shell Cookbook
Starlink Document sc4
Malcolm J. Currie
1998 January 9
E-mail:ussc@star.rl.ac.uk
(END)