Sponsored Content
Top Forums Shell Programming and Scripting bash script for showing last users Post 302365547 by peterro on Tuesday 27th of October 2009 11:01:49 AM
Old 10-27-2009
Ok, I'm still sticking with this being a more complex problem than a single pipe-line command. If someone else has a better solution, that'd be great.

Some pseudo code:

Code:
Convert your date range input to seconds since epoch for easier calculation (date command can do this depending on version)
  (input start point and input end point ISP and IEP)
Get your pared down output from the 'last' command
for each entry{
  convert that logged in range to seconds since epoch for easier calculation
    (entry start point and entry end point ESP and EEP)
  determine if ((ESP > ISP) and (ESP < IEP)) or ((EEP > ISP) and (EEP < IEP))     # Entry is somewhere within specified range
  If the entry is within the range, save it for later calculations
  Determine when to stop reading 'last' input because the rest don't fall
  into your specified range.
}
Now take the entries that are within your range
  find the unique names and their number of entries and sort by alpha

This would be a useful script if you get it working. Maybe you could post it when done.
 

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

bash/awk scripting help (creating OLD new users)

I need some help making this script... I guess I'm having trouble even interpretating what to even get started on... I need to create a script that will search a given directory (typically a user's home directory, but not necessarily) as provided on the command line and any sub-directors for... (2 Replies)
Discussion started by: Jukai
2 Replies

2. Shell Programming and Scripting

Showing offline users

Hi, Is there any command for showing offline users? The only way I can think of doing it (as i cant find a command) is getting a list of all the online users, and comparing it to /etc/passwd, anything that is in /etc/passwd and not in the users file will be offline users. But I have no... (4 Replies)
Discussion started by: mikejreading
4 Replies

3. Shell Programming and Scripting

Bash Help: users who are not logged into the system to display

A Newbie here, I am working on a script and am having problems with the else part of the script. I can't get the users who are not logged into the system to display on the screen with their username and the text "The user is not logged in". I am sure it is something simple and stupid, but I... (5 Replies)
Discussion started by: rchirico
5 Replies

4. UNIX for Dummies Questions & Answers

Need help showing which network protocol users use.

I'm having a bit of a trouble trying to figure out how to tell which network protocol users HAVE been logging in with. I know how to find this information for currently logged in users : maximillian.gardner@syccuxfs01:~> who joseph.blosser pts/0 2012-01-15 14:07 (198.107.160.185)... (5 Replies)
Discussion started by: maximillian.g
5 Replies

5. Red Hat

Showing all users in 'users' and 'top' commands

Hi All, I work in a multi user environment where my school uses Red Hat Linux server. When I issue commands such as "top" or "users", I get to see what others are doing and what kinds of applications they are running (even ps -aux will give such information). "users" will let me know who else is... (1 Reply)
Discussion started by: shoaibjameel123
1 Replies

6. Shell Programming and Scripting

Script in bash wchich creating a new users...

Hi, I am a new on this forum but i like :) I need a script in bash which will be crating a new user with folder for websites. For example: I will run this program and he creating a new user(with my name) and folder whcich name like user and if i will localho/~user in browser, she show me files from... (1 Reply)
Discussion started by: puclavv
1 Replies

7. UNIX for Dummies Questions & Answers

About adding users from a text file using bash

hello, I try to add users from a text file with this form: username:groupename:homedir first i extract data which is separated by ":" then i use useradd to add users/groups. but,,, my code doesn't works : #!/bin/bash echo "give me a text file: " read dir # control if... (2 Replies)
Discussion started by: ref012
2 Replies

8. Ubuntu

Expect /bash, 2 ssh login users

HI all i need to connect to about 900 cisco routers and switch to do some configs changes. the issue i am having is that half the devices have one set of username and password and the other half have another username and password. From expect or bash script i can ssh into a device and make... (1 Reply)
Discussion started by: quintin
1 Replies

9. Shell Programming and Scripting

How to block first bash script until second bash script script launches web server/site?

I'm new to utilities like socat and netcat and I'm not clear if they will do what I need. I have a "compileDeployStartWebServer.sh" script and a "StartBrowser.sh" script that are started by emacs/elisp at the same time in two different processes. I'm using Cygwin bash on Windows 10. My... (3 Replies)
Discussion started by: siegfried
3 Replies
odump(1)						      General Commands Manual							  odump(1)

Name
       odump - dumps selected parts of an object file

Syntax
       odump [ options ] file...

Description
       The command dumps selected parts of each object file.  This command works for object files and archives of object files.

Options
       The following options are available with the command:

       -a	  Dumps the archive header for each member of the specified archive file.

       -f	  Dumps each file header.

       -g	  Dumps the global symbols from the symbol table of a RISC archive.

       -o	  Dumps each optional header.

       -h	  Dumps section headers.

       -i	  Dumps the symbolic information header.

       -s	  Dumps section contents.

       -r	  Dumps relocation information.

       -l	  Dumps line number information.

       -t	  Dumps symbol table entries.

       -zname	  Dumps line number entries for the specified function name.

       -c	  Dumps the string table.

       -L	  Interpret and print the contents of the .lib sections.

       -F	  Dumps the file descriptor table.

       -P	  Dumps the procedure descriptor table.

       -R	  Dumps the relative file index table.

       The command accepts these modifiers with the options:

       -dnumber   Dumps  the  section  number or a range of sections starting at number and ending either at the last section number or the number
		  you specify with +d.

       +dnumber   Dumps sections in the range beginning with the first section or beginning with the section you specify with -d.

       -nname	  Dumps information only about the specified name.  This modifier works with -h, -s, -r, -l, and -t.

       -p	  Does not print headers

       -tindex	  Dumps only the indexed symbol table entry.  You can also specify a range of symbol table entries by using the modifier  -t  with
		  the +t option.

       +tindex	  Dumps  the symbol table entries in the specified range.  The range begins at the first symbol table entry or at the entry speci-
		  fied by -t.  The range ends with the specified indexed entry.

       -u	  Underlines the name of the file for emphasis.

       -v	  Dumps information symbolically rather than numerically (for example, Static rather than 0X02 ).  You can use	-v  with  all  the
		  options except -s.

       -zname,number
		  Dumps the specified line number entry or a range of line numbers.  The range starts at the number for the named function.

       +znumber   Dumps line numbers for a specified range.  The range starts at either the name or number specified by -z The range ends with the
		  number specified by +z.

       Also, an option and its modifier can be separated by using blanks.  The name can be separated from the number that modifies -z by replacing
       the comma with a blank.

       The command tries to format information in a helpful way, printing information in character, hexadecimal, octal, or decimal as appropriate.

See Also
       a.out(5), ar(5)

								       RISC								  odump(1)
All times are GMT -4. The time now is 06:19 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy