Sorting user by last login an count


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Sorting user by last login an count
# 8  
Old 04-18-2012
Hello ni2 sorry for late reply, here is what i get
Code:
infodb-> date +%d-%b-%Y --date="1 day ago"
18-Apr-2012

Hello Pamu. i tried get a exception for -E
Code:
infodba-ie10ux014:/home/infodba/execute\n\r-> awk -F"|" '{print $2}' lastlogin_user.txt | grep -E "$(date +%d-%b-%Y --date="1 day ago")|$(date +%d-%b-%Y)"
grep: illegal option -- E
Usage: grep -hblcnsviw pattern file . . .
infodba-ie10ux014:/home/infodba/execute\n\r->

# 9  
Old 04-18-2012
You should get 17-Apr-2012 not 18-Apr-2012.

Here are some other options on date arithmetic.

https://www.unix.com/answers-frequent...rithmetic.html

HTH
# 10  
Old 04-18-2012
ni2

thank you, i got thoufgh the FAQ page, this is what i used
Code:
$ export DATE_STAMP=`TZ=CST+24 date +%d-%b-%Y`
$awk -F"|" '{print $2}' lastlogin_user.txt | grep $DATE_STAMP|wc -l

Stillw ondering why the frirt command is not working
Code:
awk -F"|" '{print $2}' lastlogin_user.txt | grep "$(date +%d-%b-%Y --date="1 day ago")" | wc -l

Thank you very much
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Count occurences of a character in a file by sorting results

Hello, I try to sort results of occurences in an array by using awk but I can't find the right command. that's why I'm asking your help ! :) Please see below the command that I run: awk '{ for ( i=1; i<=length; i++ ) arr++ }END{ for ( i in arr ) { print i, arr } }' dictionnary.txt ... (3 Replies)
Discussion started by: destin45
3 Replies

2. AIX

User Account Login Login on your AIX server

I want to learn AIX. I would like to find someone who would be willing to give me a login to their AIX home lab server. My intent is to poke around and discover the similarities and differences of AIX compared to other *NIXs. I am a UNIX admin so I can think of what some immediate concerns may... (1 Reply)
Discussion started by: perl_in_my_shel
1 Replies

3. Shell Programming and Scripting

How to Login as another user through Shell script from current user[Not Root]

Hi Every body, I would need a shell script program to login as different user and perform some copy commands in the script. example: Supppose ora_toms is the active user ora_toms should be able to run a script where user: ftptomsp pass: XXX should login through and run the commands ... (9 Replies)
Discussion started by: ujjwal27
9 Replies

4. Solaris

Reset failed login count

Hi, Can someone tell me the command to do this in solaris 5.10 please? I've trawled around the internet for ages but all I can find is the AIX command... Thanks (2 Replies)
Discussion started by: Grueben
2 Replies

5. AIX

Clear failed login count

What's actually the difference between these two command: 1) chsec -f /etc/security/lastlog -a "unsuccessful_login_count=0" -s username 2) chuser unsuccessful_login_count=0 username Are there any impact on executing either one of those command to clear/reset the failed login count in AIX?... (2 Replies)
Discussion started by: ph4nt0m227
2 Replies

6. Shell Programming and Scripting

Uniq sorting and count

Hi Unix gurus, I have a requirement where I need to find the file count based on unique file names. OPEN_INV_MMDDYYYY_HHMM.xls OPEN_INV_MMDDYYYY_HHMM.xls OPEN_INV_MMDDYYYY_HHMM.xls CLOSE_INV_MMDDYYYY_HHMM.xls CLOSE_INV_MMDDYYYY_HHMM.xls OPEN_INV_MMDDYYYY_HHMM.txt... (2 Replies)
Discussion started by: shankar1dada
2 Replies

7. Solaris

error message rmclomv ... SC Login Failure for user Please login:

Hello World ~ HW : SUN Fire V240 OS : Solaris 8 Error message prompts 'rmclomv ... SC login failure ...' on terminal. and Error Message prompts continually 'SC Login Failure for user Please login:' on Single Mode(init S) The System is in normal operation, though In case of rain, Can... (1 Reply)
Discussion started by: lifegeek
1 Replies

8. Shell Programming and Scripting

help about user sorting

Hi Folks, I need help in script idea, i have 5 users and there home directories are /home/user1 /home/user2 /home/user3 /home/user4 /home/user5 /home/user5 In each user there is a file xyz.txt and abcd.txt. I have two objectives. 1. sort those user have xyz.txt and abcd.txt not... (2 Replies)
Discussion started by: learnbash
2 Replies

9. UNIX for Dummies Questions & Answers

Sorting using count, grep and count

Hi, I trying to sort information in a file by making count for every object. For example: A B A D A B C i would like to sort out count for each object (A's, B's and etc) but in actual case i dont know the object but i know the position ofthe object. do i need to use array as well? Any... (2 Replies)
Discussion started by: sukhpal_78
2 Replies
Login or Register to Ask a Question