summaryrefslogtreecommitdiffstats
path: root/contrib/awk/awklib/eg/lib/rewind.awk
blob: 33286611341cfa721b5426d7954fb00c939dadb8 (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@gnu.org, 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
}
OpenPOWER on IntegriCloud