how to filter `last` command for yesterday only


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting how to filter `last` command for yesterday only
# 1  
Old 06-25-2008
how to filter `last` command for yesterday only

Hi Expert,
May I know how to filter `last` command out put for yesterday only ?

my `last` command out put:

user1 pts/3 192.168.0.12 Wed Jun 25 03:58 still logged in
user1 pts/3 192.168.0.33 Wed Jun 23 02:08 - 09:58 (00:49)
user2 pts/1 192.168.0.21 Wed Jun 25 04:59 still logged in
user2 pts/0 10.0.0.9 Wed Jun 24 06:47 still logged in

many thanks !
# 2  
Old 06-26-2008
Found alternative solution.

1) create a script to record time to file today and use tomorrow. ( over write the entry each day). And assign the variable by using that value.

2) create a crontab entry to run automatically everyday 1 time.Smilie
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Including Hash / in sed command filter

Hello All, I want to print data in between two lines in a file sample.txt through more or cat command on the screen. For that I am using below sed command to give the BEGIN and END text. Content of sample.txt server01:~ # cat /proc/mdstat Hello this is a text message 1 Hello this is a... (5 Replies)
Discussion started by: Xtreme
5 Replies

2. Shell Programming and Scripting

Filter pattern in grep command

Hi, I am having a file like below hello how are you hello... (5 Replies)
Discussion started by: rohit_shinez
5 Replies

3. Shell Programming and Scripting

Use of awk to filter out the command output

Hi All, I am trying to find out number of cores present for hp-ux server from the output of print_manifest (as shown below). i suppose awk will be best tool to use for filtering. output of print_manifest is : System Hardware Model: ia64 hp Integrity Virtual Partition ... (6 Replies)
Discussion started by: omkar.jadhav
6 Replies

4. Shell Programming and Scripting

How to get tomorrow,yesterday date from date Command

Hi I want to get tomorrow and yesterday date from date command. My shell is KSH and server is AIX. I tried several options, but unable to do. Please help on this. Regards Rajesh (5 Replies)
Discussion started by: rajeshmepco
5 Replies

5. Shell Programming and Scripting

Problem with filter data using sed command

Hi, I am using the following command(sed) to get the key/value pair from the string String="{ "test":"test message", "testmessage":"subscription is active, charge successfully} " }" status=$( echo $String | sed -e 's/^.*\("testmessage":*\).*$/\1/') echo $status i am getting this... (2 Replies)
Discussion started by: nanthagopal
2 Replies

6. Homework & Coursework Questions

Filter command arguments

Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted! 1. The problem statement, all variables and given/known data: Execute command with integer list arguments such as myScript 8 7 2 3. Take those arguments and square all of... (2 Replies)
Discussion started by: Learn4Life
2 Replies

7. UNIX for Dummies Questions & Answers

Move Command with Adding Yesterday date

How to move a file with mv command by adding yesteday's date(YYYYMMDD) at the end Example: /a/abc.txt should be moved to the same folder /a/abc_yyyymmdd.txt YYYYMMDD should be yesterday's date (2 Replies)
Discussion started by: eskay
2 Replies

8. Homework & Coursework Questions

Using tail with the filter command

Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted! 1. The problem statement, all variables and given/known data: Devise a chain of filters using some or all of the following programs pr, cut, cat, tail to display a numbered... (8 Replies)
Discussion started by: hbell221
8 Replies

9. Shell Programming and Scripting

filter grep command

I have ran into a small issue and I am not sure how to fix it. In one of our current scripts we have this line which does a grep to get the pid of the process. ps -ef | grep nco_p_syslog | grep $x | awk '{print $2}' However this is not returning anything due to the how long the value... (7 Replies)
Discussion started by: LRoberts
7 Replies

10. UNIX for Dummies Questions & Answers

Help in Find command filter test files

Hi, I want to get all the files under a directory with find command and filter the filenames with "test" . Could you please hep me how can I build this commad Operating System : Solaris 8 (4 Replies)
Discussion started by: TonySolarisAdmi
4 Replies
Login or Register to Ask a Question