Sponsored Content
Full Discussion: date manipulation
Top Forums Shell Programming and Scripting date manipulation Post 302181525 by jim mcnamara on Thursday 3rd of April 2008 08:16:58 AM
Old 04-03-2008
Code:
touch -t YYYYMMDDhhmmss /tmp/touchfile
find ./  ! -older /tmp/touchfile  | \
while read file
do
  # do stuff with the file here
done

where YYYYMMDDhhmmss is, say, midnight (the start of today)
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

date manipulation

I'm writing a ksh script in which I want to present the user with a choice of choosing any of the last 15 days. i.e., a list like the following: 20040510 (today) 20040509 (yesterday) 20040508 . . . 20040426 Is there an easy way to produce the date from x number of days ago other than... (3 Replies)
Discussion started by: jalburger
3 Replies

2. Shell Programming and Scripting

Date Manipulation

I need to achieve the following.....I seached the forum but could not find it... This is I have in a file... "CH","TIA","10/27/2006",000590 I need the date in the third field to be attached to fileas 20061027_test.txt How do I do it. (6 Replies)
Discussion started by: mgirinath
6 Replies

3. Shell Programming and Scripting

Manipulation of Date in Shell

Reuirement: I have a set of files ina diectory which has the name in format "WWW-YYYYmmDD" like, WWW-20070226. for 26th FEB 2007. Now I need to write a shell script which should move the files to directory named "old" in the same directory if date attached to file is 90 days prior to today's... (1 Reply)
Discussion started by: jnanesh.b
1 Replies

4. UNIX for Dummies Questions & Answers

Date Manipulation with files

Hi, I have a timestamp stored in a variable start_time=17-JUL-2009 03:45, I need to search a file for this time stamp line by line (where each line has a time stamp in the file) if the time stamp is greater than the start_time variable value need to grep that line for a string and if the string... (2 Replies)
Discussion started by: happyrain
2 Replies

5. Shell Programming and Scripting

Date manipulation

Hi Gurus, How to minus 15 minuets from current system time. For example if current time is " Wed Oct 14 12:12:38 BST 2009", i need "Wed Oct 14 11:57:38 BST 2009" Thanks (2 Replies)
Discussion started by: kumarmani
2 Replies

6. Shell Programming and Scripting

Date manipulation

How can i print a future time, so i get current time by date "+%H:M" but how can i say add 20 minutes to the current time and display as I have just done for current time. (1 Reply)
Discussion started by: kelseyh
1 Replies

7. Shell Programming and Scripting

Date Manipulation

I have a file with a field containing the following: "7/3/2009 7:07:12 PM","xxxx" I need to be able to split this field up into two into a different format with the time being converted into 24 hour: so that i can get the following: "20090307","19:07:12","xxxx" (8 Replies)
Discussion started by: Pablo_beezo
8 Replies

8. Shell Programming and Scripting

Date Manipulation and Comparision

Hi All, I want to generate quarter dates using awk or anything, by giving a dates as input for example : start_date=2010-01-01 end_date=2010-05-31 output should be: start_date end_date qtr 2010-01-01 2010-03-31 1 2010-04-01 2010-05-31 2 Example 2:... (1 Reply)
Discussion started by: sol_nov
1 Replies

9. Shell Programming and Scripting

Date manipulation

In my shell script I take date as a input parameter from command line in the format "21 Oct 2011" which would be date +'%d %b %Y' Now i need to do two things here. 1) Validate the date entered by user 2) Calculate yesterday's date from the input. So in this case it should be: "20 Oct 2011"... (9 Replies)
Discussion started by: davidtd
9 Replies

10. Shell Programming and Scripting

Date-Manipulation-1

Hallo Team I can perform the task manually but i would like to automate this process. ok here goes. I have a perl script which runs every Wednesday every week and the name of the script is check_19.pl This is how the script looks like : #!/usr/bin/perl -w #use strict; use DBI; #... (1 Reply)
Discussion started by: kekanap
1 Replies
LAST, LASTB(1)                                                     User Commands                                                    LAST, LASTB(1)

NAME
last, lastb - show a listing of last logged in users SYNOPSIS
last [options] [username...] [tty...] lastb [options] [username...] [tty...] DESCRIPTION
last searches back through the /var/log/wtmp file (or the file designated by the -f option) and displays a list of all users logged in (and out) since that file was created. One or more usernames and/or ttys can be given, in which case last will show only the entries matching those arguments. Names of ttys can be abbreviated, thus last 0 is the same as last tty0. When catching a SIGINT signal (generated by the interrupt key, usually control-C) or a SIGQUIT signal, last will show how far it has searched through the file; in the case of the SIGINT signal last will then terminate. The pseudo user reboot logs in each time the system is rebooted. Thus last reboot will show a log of all the reboots since the log file was created. lastb is the same as last, except that by default it shows a log of the /var/log/btmp file, which contains all the bad login attempts. OPTIONS
-a, --hostlast Display the hostname in the last column. Useful in combination with the --dns option. -d, --dns For non-local logins, Linux stores not only the host name of the remote host, but its IP number as well. This option translates the IP number back into a hostname. -f, --file file Tell last to use a specific file instead of /var/log/wtmp. The --file option can be given multiple times, and all of the specified files will be processed. -F, --fulltimes Print full login and logout times and dates. -i, --ip Like --dns , but displays the host's IP number instead of the name. -number -n, --limit number Tell last how many lines to show. -p, --present time Display the users who were present at the specified time. This is like using the options --since and --until together with the same time. -R, --nohostname Suppresses the display of the hostname field. -s, --since time Display the state of logins since the specified time. This is useful, e.g., to easily determine who was logged in at a particular time. The option is often combined with --until. -t, --until time Display the state of logins until the specified time. --time-format format Define the output timestamp format to be one of notime, short, full, or iso. The notime variant will not print any timestamps at all, short is the default, and full is the same as the --fulltimes option. The iso variant will display the timestamp in ISO-8601 format. The ISO format contains timezone information, making it preferable when printouts are investigated outside of the system. -w, --fullnames Display full user names and domain names in the output. -x, --system Display the system shutdown entries and run level changes. TIME FORMATS
The options that take the time argument understand the following formats: YYYYMMDDhhmmss YYYY-MM-DD hh:mm:ss YYYY-MM-DD hh:mm (seconds will be set to 00) YYYY-MM-DD (time will be set to 00:00:00) hh:mm:ss (date will be set to today) hh:mm (date will be set to today, seconds to 00) now yesterday (time is set to 00:00:00) today (time is set to 00:00:00) tomorrow (time is set to 00:00:00) +5min -5days NOTES
The files wtmp and btmp might not be found. The system only logs information in these files if they are present. This is a local configu- ration issue. If you want the files to be used, they can be created with a simple touch(1) command (for example, touch /var/log/wtmp). FILES
/var/log/wtmp /var/log/btmp AUTHOR
Miquel van Smoorenburg <miquels@cistron.nl> AVAILABILITY
The last command is part of the util-linux package and is available from Linux Kernel Archive <https://www.kernel.org/pub/linux/utils/util- linux/>. SEE ALSO
login(1), wtmp(5), init(8), shutdown(8) util-linux October 2013 LAST, LASTB(1)
All times are GMT -4. The time now is 07:06 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy