Sponsored Content
Top Forums Shell Programming and Scripting Problems in analysing SSH LOG users & time Post 302899164 by gacanepa on Sunday 27th of April 2014 11:02:48 PM
Old 04-28-2014
You did not mention your operating system and shell, so I am assuming Linux and bash here. Please note that under different OS and/or shell, you may need to tweak the commands a little:
#1)
Code:
gacanepa@debian $ cat logtest.txt | sort -uk1,1 | cut -f1,3
cc1     swapnil-inspiron
cc2     swapnil-inspiron
cc3     172.27.23.49
cc4     swapnil-inspiron
cc5     swapnil-inspiron
cc6     172.27.23.46
cc7     172.27.23.116
cc8     172.27.23.49
swapnil     :0
gacanepa@debian $ cat logtest.txt | sort -uk1,1 | cut -f1,3 | wc -l
9
gacanepa@debian $

As to #2, when you say "particular time" do you mean a fixed date and time, like Apr 21 18:46?
Assuming that you want to filter by month and day, you can do something like this:
Code:
gacanepa@debian $ cat logtest.txt | awk '/Apr/ && /24/'
cc7     pts/5     172.27.23.246        Mon    Apr    21    18:45    -    18:46    (00:00)     
swapnil     pts/4     172.27.23.125        Thu    Apr    24    01:00    -    01:09    (00:03)     
cc4     pts/3     172.27.23.131        Thu    Apr    24    01:02    -    01:05    (00:03)     
cc7     pts/3     172.27.23.116        Thu    Apr    24    01:03    -    01:03    (00:00)     
swapnil     pts/4     172.27.23.125        Thu    Apr    24    01:05    -    01:08    (00:03)
cc5     pts/5     172.27.23.19        Wed    Apr    24    01:09    -    01:10    (00:01)
cc6     pts/3     172.27.23.131        Wed    Apr    24    13:42    -    13:42    (00:00)     
cc4     pts/3     172.27.23.131        Wed    Apr    24    13:42    -    13:43    (00:01)     
cc7     pts/3     172.27.23.116        Wed    Apr    24    13:43    -    13:43    (00:00)     
cc1     pts/3     172.27.23.116        Wed    Apr    24    13:43    -    13:43    (00:00)     
cc8     pts/3     172.27.23.116        Wed    Apr    24    13:43    -    13:43    (00:00)     
swapnil     pts/3     172.27.23.116        Wed    Apr    24    13:44    -    13:47    (00:03)
cc3     pts/4     172.27.23.131        Wed    Apr    24    13:44    -    13:47    (00:03)
cc7     pts/5     172.27.23.246        Wed    Apr    24    13:45    -    13:46    (00:00)     
cc5     pts/3     172.27.23.123        Wed    Apr    24    13:46    -    13:47    (00:01)
swapnil     pts/3     172.27.23.116        Wed    Apr    24    13:44    -    13:47    (00:03)
cc3     pts/4     172.27.23.131        Wed    Apr    24    13:44    -    13:47    (00:03)
cc7     pts/5     172.27.23.246        Wed    Apr    24    13:45    -    13:46    (00:00)     
cc5     pts/3     172.27.23.123        Wed    Apr    24    13:46    -    13:55    (00:09)
gacanepa@debian $ cat logtest.txt | awk '/Apr/ && /24/' | wc -l
19
gacanepa@debian $

Hope you find this useful. Let us know if you need further help with #3.
Best regards.
 

9 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

log users real time

hi.... how i can configurator a log file on real time....on unix solaris.... thanks a lot.... Best Regards... (3 Replies)
Discussion started by: chanfle
3 Replies

2. Solaris

OS Problems -no DNS & SSH not working

I just installed Solaris 6/10 without any problems but I didn't connect the network cable when I installed it. Here are my problems: -I can access webpages using IP addrsses but not with domain names -ssh is installed but it is not running ('ps -e | grep sshd' didn't show it) I have been... (4 Replies)
Discussion started by: kungpow
4 Replies

3. UNIX for Advanced & Expert Users

Analysing truss log

I am facing the following issue when using db2. The JDBC prepared statement command is sending an incorrect value to the database for search. I did a truss on the app and here is the log. I want to know what is the value that is getting passed. is it possible. 26867/68: send(62,... (2 Replies)
Discussion started by: buytamil
2 Replies

4. UNIX for Dummies Questions & Answers

Help analysing progress of a log file

Is it possible to track the progress of a job (informatica) by analysing the progress of it's log file ? I have a long running job, and no way of tracking how far allong it is. Thanks. (4 Replies)
Discussion started by: cosmos328is
4 Replies

5. UNIX for Dummies Questions & Answers

Analysing Log Files?

I'm not sure if this query is relevant to this forum but here goes anyways... I want analyse log files that do not appear to be of standard format. I have tried using Analog but cannot config it to read the files. Does anyone have any advice on working with log files taken from a Unix... (6 Replies)
Discussion started by: Sepia
6 Replies

6. Shell Programming and Scripting

How to list Commands used by users & with time stamp

hi, Do anybody know, how to list out all the commands & scripts used by the user & root along with the timestamps under ksh & csh shells. Thanks in advance Regards BS (1 Reply)
Discussion started by: raghunsi
1 Replies

7. Shell Programming and Scripting

Monitoring a users log in time?

how do i start with this guys? Sample run: $ LOGTIME it2015678 <enter> User it2015678 is CRUZ Tommy H And has logged on to the system for: 8 hours 12 minutes from the time this script was run. (1 Reply)
Discussion started by: skypigeon
1 Replies

8. Shell Programming and Scripting

Specified log in time for users

I have this task : Check the logintime.txt every minute to only allow user to log in at the specified time. logintime.txt has the following content: USER TIME_START TIME_STOP Example: john 17:00 18:00 My idea is locking the user at the TIME_STOP and unlocking at the TIME_START while... (4 Replies)
Discussion started by: muffle
4 Replies

9. Homework & Coursework Questions

Sort current logged in users by log in time (supposedly to be very easy but I'm missing something)

1. The problem statement, all variables and given/known data: Show all users who are currently logged in, sorted from earliest to latest log in time. The log in time includes the month, day, and time. 2. Relevant commands, code, scripts, algorithms: finger, who, sort, pipe, head, tail, ... (8 Replies)
Discussion started by: vtmd
8 Replies
PAPS(1) 						      General Commands Manual							   PAPS(1)

NAME
paps - UTF-8 to PostScript converter using Pango SYNOPSIS
paps [options] files... DESCRIPTION
paps reads a UTF-8 encoded file and generates a PostScript language rendering of the file. The rendering is done by creating outline curves through the pango ft2 backend. OPTIONS
These programs follow the usual GNU command line syntax, with long options starting with two dashes (`-'). A summary of options is included below. --landscape Landscape output. Default is portrait. --columns=cl Number of columns output. Default is 1. Please notice this option isn't related to the terminal length as in a "80 culums terminal". --font=desc Set the font description. Default is Monospace 12. --rtl Do right to left (RTL) layout. --paper ps Choose paper size. Known paper sizes are legal, letter and A4. Default is A4. Postscript points Each postscript point equals to 1/72 of an inch. 36 points are 1/2 of an inch. --bottom-margin=bm Set bottom margin. Default is 36 postscript points. --top-margin=tm Set top margin. Default is 36 postscript points. --left-margin=lm Set left margin. Default is 36 postscript points. --right-margin=rm Set right margin. Default is 36 postscript points. --gutter-width=gw Set gutter width. Default is 40 postscript points. --help Show summary of options. --header Draw page header for each page. --markup Interpret the text as pango markup. --lpi Set the lines per inch. This determines the line spacing. --cpi Set the characters per inch. This is an alternative method of specifying the font size. --stretch-chars Indicates that characters should be stretched in the y-direction to fill up their vertical space. This is similar to the texttops behaviour. AUTHOR
paps was written by Dov Grobgeld <dov.grobgeld@gmail.com>. This manual page was written by Lior Kaplan <kaplan@debian.org>, for the Debian project (but may be used by others). April 17, 2006 PAPS(1)
All times are GMT -4. The time now is 02:27 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy