1

I need to determine when was the last login time from some login times i have. So! I have the date in this format : month as in Oct Sep Jan etc. then follows the day in numeric form 22, 23, 1... and the time of the login 00:49, 03:21 etc. The times are ranging from 22:00 - 05:00. So night logins. a few examples : Oct 12 00:53, Oct 13 00:35, Oct 23 22:53 I have found out there is a date function but i have trouble using it with the current date format i have.

closed as unclear what you're asking by Jeff Schaller, steve, JigglyNaga, Thomas, schily Oct 26 '18 at 14:32

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • 1
    It would be better to show a complete example of the type of date that you have, together with how that date should look after transformation. Also, it's slightly surprising to see someone trying to learn scripting in csh nowadays. It's a perfectly valid thing to want to do, but that particular shell is rather well known to be, let's say "different", than most common shells, and only a handful of people here use it even as their interactive shell. – Kusalananda Oct 26 '18 at 8:37
  • 1
    What operating system is it? On GNU systems, you'd be able to use date -d 'Oct 12 00:53' +%s. Are perl, zsh or ksh93 available? – Stéphane Chazelas Oct 26 '18 at 10:04
  • Im getting this date from here: set users = "` last | sort | tr -s '\t' ' ' | grep '[0,2][0-4]:[0-5][0-9] -' | grep -v '[2][0-1]:[0-5][0-9] -' | cut -d ' ' -f1 -f5 -f6 -f7 " the -f1 column is the users name, then i cut from this like so: set pomocny_1 = " echo "\$users[1]" | cut -d ' ' -f2 -f3 -f4 `" – Michael Kročka Oct 26 '18 at 10:31
  • The OS is windows, im logging into the school server using putty.exe – Michael Kročka Oct 26 '18 at 10:36
  • This is the Unix & Linux SE, so "What operating system is it?" refers to the Unix/Linux machine where the logins happen -- the server, in your case. See How can I get distribution name and version number.... – JigglyNaga Oct 26 '18 at 10:57

Browse other questions tagged or ask your own question.