aboutsummaryrefslogtreecommitdiff
path: root/coreutils-5.3.0-bin/share/awk/rewind.awk
blob: a646eac2d379af2e9c77d5203a5466976b6fd283 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# rewind.awk --- rewind the current file and start over
#
# Arnold Robbins, arnold@skeeve.com, Public Domain
# September 2000

function rewind(    i)
{
    # shift remaining arguments up
    for (i = ARGC; i > ARGIND; i--)
        ARGV[i] = ARGV[i-1]

    # make sure gawk knows to keep going
    ARGC++

    # make current file next to get done
    ARGV[ARGIND+1] = FILENAME

    # do it
    nextfile
}