in first part
$0 ~/[Ss]ystem/ && /puls/
is implicit for
$0 ~/[Ss]ystem/ && $0 ~ /puls/
so
if(k1[i] ~/[Ss]ystem/ && /puls/)
should be written as
if(k1[i] ~/[Ss]ystem/ && k1[i] ~ /puls/)
- in former case
/pusl/is likely to belikely to be(*) matched against last line of/etc/passwd. - also see
man awkbut~(and!~) have priority over&&
(*) confirmed, if I move PulseAudio line to last line, as match is made.