0

file1.txt

Message Id:4401811003996404

file2.txt

Message Id:4401811003996404 End Time

Message Id:4401811007868646 End Time

I tried to use cut to trim the End Time from the file2.txt but it cut digits too.

Also tried comm -12 file1.txt and file2.txt, output was blank.

I want output something like this

Message Id:4401811003996404

Community
  • 1
  • 1

1 Answers1

0

Simple:

two files, uno and due.

[root@srvrux33 ~]# cat uno
1 end
2 end
3 end
1 end
[root@srvrux33 ~]# cat due
1
3
[root@srvrux33 ~]#

You can achieve your result in the following way:

[root@srvrux33 ~]# for L in $(cat due); do grep $L uno| uniq | awk '{ print $1 }'; done
1
3
[root@srvrux33 ~]#

Regards Giova

Giova
  • 1,137
  • 1
  • 9
  • 17
  • Thanks Giova.It worked.Could you please explain me the logic.Thanks in advance. – Akshatha Prabhu Aug 21 '15 at 17:16
  • It works for the above scenario.But to make sure it is not printing value from one of the file twice i added start and end to above file.This way below file1.txt Start Message Id:4401811003996404 and file2.txt End Message Id:4401811003996404 End Time End Message Id:4401811007868646 End Time.It displayed content of file2.txt repeated.May be if i understand logic i would be able to find a way to make this work.Thanks for the help – Akshatha Prabhu Aug 21 '15 at 18:07