Debian Codegraph @

awklib/eg/lib/readable.awk

raw
1 # readable.awk --- library file to skip over unreadable files
2 #
3 # Arnold Robbins, [email protected], Public Domain
4 # October 2000
5 # December 2010
6
7 BEGIN {
8 for (i = 1; i < ARGC; i++) {
9 if (ARGV[i] ~ /^[a-zA-Z_][a-zA-Z0-9_]*=.*/ \
10 || ARGV[i] == "-" || ARGV[i] == "/dev/stdin")
11 continue # assignment or standard input
12 else if ((getline junk < ARGV[i]) < 0) # unreadable
13 delete ARGV[i]
14 else
15 close(ARGV[i])
16 }
17 }