Skip to main content
added 93 characters in body
Source Link
Archemar
  • 32.3k
  • 18
  • 75
  • 107

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 awk but ~ (and !~) have priority over &&

(*) confirmed, if I move PulseAudio line to last line, as match is made.

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 be matched against last line of /etc/passwd.
  • also see man awk but ~ (and !~) have priority over &&

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 be (*) matched against last line of /etc/passwd.
  • also see man awk but ~ (and !~) have priority over &&

(*) confirmed, if I move PulseAudio line to last line, as match is made.

Source Link
Archemar
  • 32.3k
  • 18
  • 75
  • 107

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 be matched against last line of /etc/passwd.
  • also see man awk but ~ (and !~) have priority over &&