ubuntu-buildroot/output/build/host-gawk-5.2.0/awklib/eg/lib/readable.awk

18 lines
489 B
Awk
Raw Normal View History

2024-04-01 15:19:46 +00:00
# readable.awk --- library file to skip over unreadable files
#
# Arnold Robbins, arnold@skeeve.com, Public Domain
# October 2000
# December 2010
BEGIN {
for (i = 1; i < ARGC; i++) {
if (ARGV[i] ~ /^[a-zA-Z_][a-zA-Z0-9_]*=.*/ \
|| ARGV[i] == "-" || ARGV[i] == "/dev/stdin")
continue # assignment or standard input
else if ((getline junk < ARGV[i]) < 0) # unreadable
delete ARGV[i]
else
close(ARGV[i])
}
}