- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Help with shell script
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-29-2000 08:23 AM
11-29-2000 08:23 AM
Help with shell script
I need to write a program using the DATE and WHO commands that prints the number of hours and minutes that a user has been logged on to the system ( assume that this is less that 24 hours.
Your help will be greatly appreciated!!!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-29-2000 08:29 AM
11-29-2000 08:29 AM
Re: Help with shell script
What about the command last?
Just thoughts
Best regards
Victor
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-29-2000 08:30 AM
11-29-2000 08:30 AM
Re: Help with shell script
last | grep
will show you the user when they logged in and how long they have been on...
rcw
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-29-2000 08:32 AM
11-29-2000 08:32 AM
Re: Help with shell script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-29-2000 08:34 AM
11-29-2000 08:34 AM
Re: Help with shell script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-29-2000 08:39 AM
11-29-2000 08:39 AM
Re: Help with shell script
who |awk -vh=`date +%H` -vm=`date +%M` '{
split($NF, a, ":")
sh=a[1];
sm=a[2];
dm=h*60+m-a[1]*60-a[2];
hh=int(dm/60);
mm=dm-hh*60;
printf("%s : %d hours %d min\n", $1, hh, mm);
}'
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-29-2000 09:03 AM
11-29-2000 09:03 AM
Re: Help with shell script
Hope this will lead you to the better output.
first run
/etc/last -R
Then filter out which information you want.
/etc/last -R|awk '{print $1, $3, $7, $8, $9, $10}'
This will display user-id, hostname or ip-address, time.
Check "man awk" for further details