loop help

Hi there,

I have 2 files:

current.uid

5516
5517
5518
5519
5520
5521
5522
5523
5524
5525

user.uid

5506
5507
5508
5509
5510
5511
5512
5513
5514
5515
5516
5517
5518
5519
5520
5521
5522
5523
5524
5525

Note: user.uid has all the number that current.uid has.

I'd like to loop through current.uid and remove these number in user.uid file and print out the difference in user.uid.

Thanks

From the manpage on comm
OPTIONS
The following options are supported:
-1 Suppresses the output column of lines unique to
file1.
-2 Suppresses the output column of lines unique to
file2.
-3 Suppresses the output column of lines duplicated in
file1 and file2.

> comm -13 file172 file173
5506
5507
5508
5509
5510
5511
5512
5513
5514
5515
nawk 'FNR==NR {a[$1]; next} !a[$1]' current.uid user.id

it prints out the output of user.uid..which is not what I wanted.

Thanks btw

Your explanation was not clear....
try switching the order of the input files:

nawk 'FNR==NR {a[$1]; next} !a[$1]' user.id current.id

sorry for the confusing...

awk 'FNR==NR{a[$0]++; next} !a[$0]' current.uid user.uid

is what I wanted..

Thanks for your help.

$ cat current.uid user.uid | sort -n | uniq -u
5506
5507
5508
5509
5510
5511
5512
5513
5514
5515

Simple but powerful:)

 
$ grep -vf curr.uid user.uid
5506
5507
5508
5509
5510
5511
5512
5513
5514
5515