Documented stuff
This commit is contained in:
@ -5,15 +5,19 @@ BEGIN {
|
||||
safe = 0
|
||||
}
|
||||
{
|
||||
# Set initial order, 0 for asc, 1 for desc
|
||||
if ($2 > $1) {
|
||||
order = 0
|
||||
} else {
|
||||
order = 1
|
||||
}
|
||||
skip = 0
|
||||
|
||||
# Loop through items on each line
|
||||
for (i = 1; i < NF; i++) {
|
||||
j = i + 1
|
||||
k = i + 2
|
||||
|
||||
# See if order is matched
|
||||
if ( $i < $j && order == 1 ) {
|
||||
if ( $i < $k && order == 1 ) {
|
||||
next
|
||||
@ -23,6 +27,8 @@ BEGIN {
|
||||
next
|
||||
}
|
||||
}
|
||||
|
||||
# Get absolute diff value
|
||||
if ( $i < $j ) {
|
||||
diff = $j - $i
|
||||
} else {
|
||||
@ -33,6 +39,8 @@ BEGIN {
|
||||
} else {
|
||||
diff2 = $i - $k
|
||||
}
|
||||
|
||||
# Verify diff within parameters
|
||||
if (diff > 3 || diff < 1) {
|
||||
if (diff2 > 3 || diff2 < 1) {
|
||||
next
|
||||
@ -40,6 +48,7 @@ BEGIN {
|
||||
}
|
||||
|
||||
}
|
||||
# If all pass, increment safe counter
|
||||
safe += 1
|
||||
}
|
||||
END {
|
||||
|
Reference in New Issue
Block a user