Experts need your help
i need to create a script which will give count of users logged between yesterday and today (Or if run exacle 12:00AM midnight, it will give count of of users logged on that day
here is how the data looks
Pappu, Paul|22-Feb-201|0|30-Jun-201
Aloor, Shiva|10-Apr-201|0|18-Aug-201
Singh, Anil|16-Mar-201|0|10-Nov-201
Sun, Henry|09-Apr-201|0|05-Sep-201
Proxy,ETS|10-Apr-201|0|08-Mar-201
Patel, Rishi|11-Feb-201|0|27-Jun-201
Dubey, Anand|16-Apr-201|0|13-Mar-201
Tiwari, Shirish|19-Feb-201|0|13-Dec-201
Vinayagam, Deiva|15-Feb-201|0|04-Jul-201
infodba_ie|28-Feb-201|0|02-Dec-201
Murugesan, Gokul|03-Apr-201|0|07-Dec-201
cntestuser|21-Mar-201|0|08-Nov-201
Gupta, Rajiv|02-Apr-201|0|27-Jun-201
Airmal, Shiva Kumar|16-Apr-201|0|09-Dec-201
Joshi, Deepak|16-Apr-201|0|17-Sep-201
Wang,Charles|10-Apr-201|0|08-Nov-201
i use awk to get last column
cat user.txt |awk -F"|" '{print $2}'`
now my output is
22-Feb-201
10-Apr-2012
16-Mar-2012
09-Apr-2012
10-Apr-2012
11-Feb-2012
16-Apr-2012
19-Feb-2012
15-Feb-2012
28-Feb-2012
03-Apr-2012
21-Mar-2012
02-Apr-2012
16-Apr-2012
16-Apr-2012
10-Apr-20122
24-Jan-2012
09-Mar-2012
16-Apr-2012
27-Feb-2012
21-Mar-2012
13-Feb-2012
03-Apr-2012
06-Mar-201
My challenge is
1- I need to sort based on month and date
2- Get a list of user logged (system time -1), mean if execute and 12-05 midnight it will give user logged yesterday
3. get the count of the rows in column 2
Please help
---------- Post updated at 05:39 AM ---------- Previous update was at 04:27 AM ----------
I was able to sort it now using sort -t '-' -k 3.1n,3.2 -k 2.1M,2.3 -k 1.1n,1.2
24-Jan-2012
11-Feb-2012
13-Feb-2012
15-Feb-2012
19-Feb-2012
22-Feb-2012
27-Feb-2012
28-Feb-2012
06-Mar-2012
09-Mar-2012
16-Mar-2012
21-Mar-2012
21-Mar-2012
02-Apr-2012
03-Apr-2012
03-Apr-2012
09-Apr-2012
10-Apr-2012
10-Apr-2012
10-Apr-2012
16-Apr-2012
16-Apr-2012
16-Apr-2012
If i get tip to get user count of yesterday's assuming i execute this 1 minute after midnight