command to check the entries of the last second


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting command to check the entries of the last second
# 8  
Old 07-21-2012
Quote:
Originally Posted by necro98
Hi clx

Linux servername 2.6.18-194.11.1.el5 #1 SMP Tue Jul 27 05:45:06 EDT 2010 x86_64 x86_64 x86_64 GNU/Linux
Ok, The latest time is in the last line of the file and you want to get the records with one second less. ( I hope I get it right)

Code:
# get the time
d1=$(tail -1 file | cut -d, -f1)

# get the 1 sec less time
d2=$(date -d "$d1 1 sec ago" +'%H:%M:%S')

#search for it
grep "^$d2" file


#output
02:19:37,device,20,server1,1
02:19:37,device,20,server2,1


#input file
02:19:35,device,20,server1,1
02:19:36,device,20,server1,1
02:19:37,device,20,server1,1
02:19:35,device,20,server2,1
02:19:36,device,20,server2,1
02:19:37,device,20,server2,1
02:19:38,device,20,server2,1

Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

How to check who run the command?

Dear Team, i need to know in linux if someone run the command in linux server where i can check on server . i need to know the below points who (user) when (date and time) what (command) regards, scriptors (1 Reply)
Discussion started by: scriptor
1 Replies

2. Shell Programming and Scripting

How-to enforce check on getopts command

here is my script that expects the user to run it like ./best.sh -f /tmp/log.txt more best.sh #!/bin/bash while getopts ":f:" opt; do case $opt in f) file_in="$OPTARG" ;; \?) echo "Invalid option -$OPTARG" >&2 ;; esac done uname -a SunOS mymac 5.11 11.2 sun4v... (15 Replies)
Discussion started by: mohtashims
15 Replies

3. Shell Programming and Scripting

Command to check only Autosys running jobs with autorep like command

Hi, Is there any specific command to use to check only say Running jobs via autorep or similar command for Autosys? (0 Replies)
Discussion started by: sidnow
0 Replies

4. Shell Programming and Scripting

Script to check one command and if it fails moves to other command

Input is list of Server's, script is basically to remove old_rootvg, So it should check first command "alt_rootvg_op -X old_rootvg" if it passes move to next server and starts check and if it fails moves to other command "exportvg old_rootvg" for only that particular server. I came up with below,... (6 Replies)
Discussion started by: aix_admin_007
6 Replies

5. Shell Programming and Scripting

Request to check:remove entries with N/A entries

Hi I have a file with numerous entries some entries are 1 mani 2 kavya 3 N/A 4 Praveeen 5 N/A and so on How to remove entries with N/A so the result will be 1 mani 2 kavya 3 Praveeen (6 Replies)
Discussion started by: manigrover
6 Replies

6. UNIX for Dummies Questions & Answers

Are there any command that will check file ????

Hi all, i will write a script. Script will sense certain directory and if a file is created it will send me an email. i know how mail is sent. But i dont know which command that check directory for file is created or not continuously. Thanx for your helping. ---------- Post updated... (5 Replies)
Discussion started by: temhem
5 Replies

7. Shell Programming and Scripting

How to check if a command returns nothing

Hi, I want to write a script that runs a command (at -l) and writes the output to a file. If the command (at -l) command returns no value (is empty/null) then write a message to the file in place of the command output. My problem is around trapping the empty returned command value and replacing... (2 Replies)
Discussion started by: Alvescot
2 Replies

8. UNIX for Dummies Questions & Answers

command for check CPU

Can someone tell me which command I should use to get the detail CPU info in one HP unix box, asuch as # of CPU, CPU Speed and CPU HW Support Thanks (2 Replies)
Discussion started by: abcde
2 Replies

9. UNIX for Dummies Questions & Answers

command to check the bit

i am using sunOS 5.8. What is the command to know the OS bit (8,32,64...) while the server is under production and is it possible to change from one bit to another?? replies appreciated raguram R (2 Replies)
Discussion started by: raguramtgr
2 Replies
Login or Register to Ask a Question
Graphics::Primitive::Insets(3pm)			User Contributed Perl Documentation			  Graphics::Primitive::Insets(3pm)

NAME
Graphics::Primitive::Insets - Space between things DESCRIPTION
Graphics::Primitive::Insets represents the amount of space that surrounds something. This object can be used to represent either padding or margins (in the CSS sense, one being inside the bounding box, the other being outside) SYNOPSIS
use Graphics::Primitive::Insets; my $insets = Graphics::Primitive::Insets->new({ top => 5, bottom => 5, left => 5, right => 5 }); METHODS
Constructor new Creates a new Graphics::Primitive::Insets. Instance Methods as_array Return these insets as an array in the form of top, right, bottom and left. bottom Set/Get the inset from the bottom. equal_to Determine if these Insets are equal to another. left Set/Get the inset from the left. right Set/Get the inset from the right. top Set/Get the inset from the top. zero Sets all the insets (top, left, bottom, right) to 0. AUTHOR
Cory Watson, "<gphat@cpan.org>" SEE ALSO
perl(1) COPYRIGHT &; LICENSE Copyright 2008-2010 by Cory G Watson. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. perl v5.12.3 2010-08-21 Graphics::Primitive::Insets(3pm)