How to print last column of line

Hello folks,

Please guide me i have a file file.txt that have below text.

PETER JOHN peter@example.com
John Col john@example.com
Sara Paul sara@example.com

I just want to extract only email address list.

try:

awk '{print $NF}' file
cat myfile | awk '{print $NF}'

or

awk '{print $NF}' myfile

will output the last field on each line

Thanks so much.

Now i have two files.

files1.txt

peter
nor
kasi
sssi
appi

files2.txt

katy
uria
possp
babbbg
seper

first i want to see those contents which are present in file1 but not present in file2, so i see its list, after that i want to see those contents which are present in file2 but not present in file1, i want to see its list as well.

Oh..Now it seems the question is changed.

Check the manpages of "diff" , "comm".

I hope the command "comm" will suite for your requirement.

.. or grep

grep -vf file1 file2
grep -vf file2 file1

---------- Post updated at 09:05 AM ---------- Previous update was at 09:03 AM ----------

learnbash you highjack your own thread. If the original problem change you should search the forum first for similar problems/solutions and if you don't find any start a new thread.
Anyway your questions are FAQ !