#!/usr/bin/env awk
#
# Splits repetitive values and provides easy access to each repetition.
# If num is omitted, val is split into distinct tab separated columns.
# If num > 0, returns the num repetition.
# If num < 0, returns the num item from the end, e.g., -1 => last element
#
# Dependencies:
#   - None
#
# See Also:
#   - splitc
#   - t2split
#
# Examples:
#   - tawk '{ print splitr($ETHVlanID, 2) }' file.txt
#   - tawk 'splitr($ETHVlanID, 2) == 20 { print splitr($ETHVlanID) }' file.txt

@include "t2split"

function splitr(val, num) {
    return t2split(val, ";", num)
}
