Imagine that we have two for example files. The first file is filled with unique names of employees created by combining the first two characters of the first name and the last 2 characters of the last name.
Example : Peter Smith - Peht
First file contains :
Peht Mawo Stso Makr Bavo
The second file contains recordings about them when they logged into the system. ( Obviously there are also employees that are not listed in
The second file:
Mawo 21.4.2016 17:49 Peht 21.4.2016 17:58 Mawo 22.4.2016 7:58 Wato 22.4.2016 7:59 Stso 22.4.2016 8:02 Bavo 22.4.2016 8:15 Bane 22.4.2016 9:01 Bavo 23.4.2016 9:12 Mawo 23.4.2016 9:24 Dalo 23.4.2016 9:54 Peht 23.4.2016 9:58 Grma 24.4.2016 10:00
I need to find out how many times employes from file1 connected to the system (
What is the best way of doing that? The only solution which came to my mind is to make some 2 loops and for each name from
file1 loop the whole
grep names, ask if the names match if yes then
count++. Could anyone give me some elegant solution for this problem using for example
awk if it's possible?