Sponsored Content
Full Discussion: Yesterday in UNIX
Top Forums UNIX for Advanced & Expert Users Yesterday in UNIX Post 302935260 by jim mcnamara on Friday 13th of February 2015 09:21:06 PM
Old 02-13-2015
Does /usr/sfw/bin on your solaris box have gdate or date?

And. If you cannot change anything at why are you asking for something that implies some kind of code change?
This works on solaris10 and solaris11 - We use it in lots of scripts.
Code:
#!/bin/ksh
# usage /path/to/then.pl 7 for date seven days ago
#          /path/to/then.pl 1  for yesterday
ago()
{
   perl -e ' my $delta = $ARGV[0];
             $delta*=86400;
             $delta=time - $delta;
             @t=localtime( $delta );
             printf("%02d-%02d-%d", $t[4]+1, $t[3], $t[5]+1900); ' $1
}

echo $(ago $1)

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

get yesterday's date?

Hello, using date, we can easily get today's date $ date +%y-%m-%d 06-12-08 is it possible for me to get yesterday's date using 'date', if not, is there any quick and easy way to do that? Thanks! (1 Reply)
Discussion started by: fedora
1 Replies

2. Shell Programming and Scripting

yesterday

How to get the date before the current date on unix tru64? Today is 2008-02-27. I'll need 2008-02-26. Thx (0 Replies)
Discussion started by: Tlg13team
0 Replies

3. Shell Programming and Scripting

Yesterday in i.e. May 09 and 05/09 format

I am not using GNU nor BSD. On AIX, how do you return yesterday in the format of i.e. "May 09" with a space. # `TZ=y380 date +%h""%d` >> May09 # `TZ=y380 date +%h" "%d` >> May I appreciate your help in advance. thx (3 Replies)
Discussion started by: Daniel Gate
3 Replies

4. UNIX for Dummies Questions & Answers

Hello and I need help like in yesterday

I haven't been using linux very long( and when I say that its only been about 1 week for me) I was told to do the following: Create a Bash script that will copy all the files and subdirectories in one directory to a newly created directory. You may name the receiving directory anything you like.... (4 Replies)
Discussion started by: reecygee
4 Replies

5. Shell Programming and Scripting

Compare date from db2 table to yesterday's Unix system date

I am currently running the following Korn shell script which works fine: #!/usr/bin/ksh count=`db2 -x "select count(*) from schema.tablename"` echo "count" I would like to add a "where" clause to the 2nd line that would allow me to get a record count of all the records from schema.tablename... (9 Replies)
Discussion started by: sasaliasim
9 Replies

6. Shell Programming and Scripting

yesterday's date

I was playing to find a simple way to get yesterday's date, and came up with this (on an AIX 5.2 box): $ date Thu Feb 19 11:21:26 EST 2009 $ echo $TZ EST5EDT $ yesterday=`TZ=$(date +%Z)+24 date` $ echo $yesterday Wed Feb 18 16:21:52 GMT 2009 Why it is converted to GMT instead of... (2 Replies)
Discussion started by: gratus
2 Replies

7. Shell Programming and Scripting

yesterday's date

curdate=$(date +"%d-%b-%y") How to get the yesterday's date. (1 Reply)
Discussion started by: sandy1028
1 Replies

8. Shell Programming and Scripting

yesterday date

HI All, I am trying so long to find the yesterday's date to run a script but i failed kinldy share the command to find yesterday's date in ksh i tried with date --date='1 day ago' but it displaying error your help will highly apeerciated. Thanks (7 Replies)
Discussion started by: thelakbe
7 Replies

9. UNIX for Beginners Questions & Answers

Yesterday

hi guys i want to know how can i insert in a variable yesterday for example : today=`date +%Y%m%d` yesterday =??? thanks a lot Please use CODE tags as required by forum rules! (4 Replies)
Discussion started by: Francesco_IT
4 Replies

10. UNIX for Beginners Questions & Answers

UNIX cluster disk usage report generation for yesterday & today and email

HI Team, I am trying to create a shell script to generate a yesterday and today report to compare and email in daily basis. can you please help me on the same. #!/bin/bash #Author: ******************* #Description: This script will return the following set of system information: ... (2 Replies)
Discussion started by: Mi4304
2 Replies
sccs-prt(1)							   User Commands						       sccs-prt(1)

NAME
sccs-prt, prt - display delta table information from an SCCS file SYNOPSIS
/usr/ccs/bin/prt [-abdefistu] [-cdate-time] [-rdate-time] [-ysid] s.filename... DESCRIPTION
prt prints selected portions of an SCCS file. By default, it prints the delta table (version log). If a directory name is used in place of the s.filename argument, the prt command applies to all s.files in that directory. Unreadable s.files produce an error; processing continues with the next file (if any). The use of `-' as the s.filename argument indicates that the names of files are to be read from the standard input, one s.file per line. OPTIONS
If any option other than -y, -c, or -r is supplied, the name of each file being processed (preceded by one NEWLINE and followed by two NEW- LINE characters) appears above its contents. If none of the -u, -f, -t, or -b options are used, -d is assumed. -s, -i are mutually exclusive, as are -c and -r. -a Display log entries for all deltas, including those marked as removed. -b Print the body of the s.file. -d Print delta table entries. This is the default. -e Everything. This option implies -d, -i, -u, -f, and -t. -f Print the flags of each named s.file. -i Print the serial numbers of included, excluded, and ignored deltas. -s Print only the first line of the delta table entries; that is, only up to the statistics. -t Print the descriptive text contained in the s.file. -u Print the user-names and/or numerical group IDs of users allowed to make deltas. -cdate-time Exclude delta table entries that are specified cutoff date and time. Each entry is printed as a single line, preceded by the name of the SCCS file. This format (also produced by -r , and -y) makes it easy to sort multiple delta tables in chronological order. When both -y and -c, or -y and -r are supplied, prt stops printing when the first of the two condi- tions is met. -rdate-time Exclude delta table entries that are newer than the specified cutoff date and time. -ysid Exclude delta table entries made prior to the SID specified. If no delta in the table has the specified SID, the entire table is printed. If no SID is specified, the most recent delta is printed. USAGE
Output Format The following format is used to print those portions of the s.file that are specified by the various options. o NEWLINE o Type of delta (D or R) o SPACE o SCCS delta ID (SID) o TAB o Date and time of creation in the form: yy/mm/dd hh/mm/ss o SPACE o Username the delta's creator o TAB o Serial number of the delta o SPACE o Predecessor delta's serial number o TAB o Line-by-line change statistics in the form: inserted/deleted/unchanged o NEWLINE o List of included deltas, followed by a NEWLINE (only if there were any such deltas and the -i options was used) o List of excluded deltas, followed by a NEWLINE (only if there were any such deltas and the -i options was used) o List of ignored deltas, followed by a NEWLINE (only if there were any such deltas and the -i options was used) o List of modification requests (MRs), followed by a NEWLINE (only if any MR numbers were supplied). o Lines of the delta commentary (if any), followed by a NEWLINE. EXAMPLES
Example 1: Examples of prt. The following command: example% /usr/ccs/bin/prt -y program.c produces a one-line display of the delta table entry for the most recent version: s.program.c: D 1.6 88/07/06 21:39:39 username 5 4 00159/00080/00636... ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Availability |SUNWsprot | +-----------------------------+-----------------------------+ SEE ALSO
sccs(1), sccs-cdc(1), sccs-delta(1), sccs-get(1), sccs-help(1), sccs-prs(1), sccs-sact(1), sccs-sccsdiff(1), what(1), sccsfile(4), attributes(5) DIAGNOSTICS
Use the SCCS help command for explanations (see sccs-help(1)). SunOS 5.10 5 Oct 1990 sccs-prt(1)
All times are GMT -4. The time now is 02:22 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy