On Wed, 14 Feb 2024, Reid wrote:
Okay, that's not my experience. Using your script and adding a row-number field
to the end of each line:
$ cat /tmp/tmp.txt
410 Auto Wrecking,410 Auto Wrecking,So3011780,Inactive,Industrial SW GP,27865
Sr 410 E,Buckley,Pierce,98321,ROW_1
410 Auto Wrecking,410 Auto Wrecking,WAR011780,Active,Industrial SW GP,27865 Sr
410 E,Buckley,Pierce,98321,ROW_2
410 Auto Wrecking,410 Auto Wrecking,So3011780,Inactive,Industrial SW GP,27865
Sr 410 E,Buckley,Pierce,98321,ROW_3
410 Auto Wrecking,410 Auto Wrecking,WAR011780,Active,Industrial SW GP,27865 Sr
410 E,Buckley,Pierce,98321,ROW_4
$ gawk -f /tmp/tmp.gawk /tmp/tmp.txt
410 Auto Wrecking,410 Auto Wrecking,So3011780,Inactive,Industrial SW GP,27865
Sr 410 E,Buckley,Pierce,98321,ROW_1
410 Auto Wrecking,410 Auto Wrecking,WAR011780,Active,Industrial SW GP,27865 Sr
410 E,Buckley,Pierce,98321,ROW_2
410 Auto Wrecking,410 Auto Wrecking,WAR011780,Active,Industrial SW GP,27865 Sr
410 E,Buckley,Pierce,98321,ROW_4
Note that the first "Inactive" line is printed because it's the first record. The second
"Inactive" line is not printed.
Reid,
Removing the subscr() and using this script:
BEGIN { FS = OFS = "," }
# NR ~ /1/ { print $0 }
$4 == "Inactive" { next }
$4 == "Active" { print $0 }
it now works; only Active rows are returned. But, when I uncomment the first
statement to print the header row I also get the inactive rows.
Why might this be?
Thanks,
Rich