Usando awk ;
$ awk 'NR==FNR{ seen[$0]++;next }
{ print $0 (($0 in seen)?" TRUE":" FALSE")}' userbanned.list alluser.list
user1 FALSE
user4 TRUE
user2 TRUE
user4 TRUE
user5 TRUE
user3 FALSE
user2 TRUE
awk desmembramento:
NR==FNR - Execute next block for 1st file only "userbanned.list"
seen[$0]++ - Create an associative array with the key as '$0' (whole line) of
file "userbanned.list"
next - continue read next line of file "userbanned.list"
print $0 - Print the whole line of "alluser.list" file, , now FNR reset to 1
since next file read by awk, but NR is still incrementing until the last
line from last file read.
(($0 in seen)?" TRUE":" FALSE")
- This known as Ternary operator '(condition)?"If-True":"If-False"'. It's
short form of if/else/ and checks if current line in file "alluser.list"
exists in array then print "TRUE" else "FALSE".
Eu vejo também que você tem usuários duplicados, o que causará impressão duas vezes ou mais, você pode uniqe as linhas em ambos os arquivos, em seguida, passá-lo para awk como abaixo:
$ awk 'NR==FNR{ seen[$0]++;next } { print $0 (($0 in seen)?" TRUE":" FALSE")}
' <(sort -u userbanned.list) <(sort -u alluser.list)
user1 FALSE
user2 TRUE
user3 FALSE
user4 TRUE
user5 TRUE