awk: forcing a return status?
Keep the status in a variable and use it in an END
block.
awk -F: 'NF != 7 {print; err = 1}
END {exit err}' /etc/passwd
I was looking for something similar to Grep, where it will exit 1 if a match is not found. Here is the equivalent with Awk:
#!/usr/bin/awk -f
BEGIN {
b1 = 1
}
index($0, "sunday") > 0 {
b1 = 0
print
}
END {
exit b1
}